[PATCH v3 1/6] riched20/tests: Lock hGlobal before use.

Jactry Zeng jzeng at codeweavers.com
Sat May 29 09:01:37 CDT 2021


Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
Superseded patch 206432 to 206436.
---
 dlls/riched20/tests/richole.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index c2457ae5146..a76f9fdaf2e 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -3252,7 +3252,7 @@ static void test_InsertObject(void)
   REOBJECT reo1, reo2, reo3, received_reo;
   HRESULT hr;
   HWND hwnd;
-  const WCHAR *expected_string;
+  const WCHAR *expected_string, *string;
   const CHAR *expected_stringA;
   ITextSelection *selection;
   IDataObject *dataobject;
@@ -3465,8 +3465,10 @@ static void test_InsertObject(void)
   formatetc.lindex = -1;
   hr = IDataObject_GetData(dataobject, &formatetc, &stgmedium);
   ok(hr == S_OK, "Got hr %#x.\n", hr);
-  todo_wine ok(lstrlenW(stgmedium.hGlobal) == lstrlenW(expected_string), "Got wrong length: %d.\n", result);
-  todo_wine ok(!lstrcmpW(stgmedium.hGlobal, expected_string), "Got wrong content: %s.\n", debugstr_w(stgmedium.hGlobal));
+  string = GlobalLock(stgmedium.hGlobal);
+  ok(lstrlenW(string) == lstrlenW(expected_string), "Got wrong length: %d.\n", lstrlenW(string));
+  todo_wine ok(!lstrcmpW(string, expected_string), "Got wrong content: %s.\n", debugstr_w(string));
+  GlobalUnlock(stgmedium.hGlobal);
 
   expected_string = L"abc\xfffc""d\xfffc""efg";
   gettextex.cb = sizeof(buffer);
-- 
2.30.2




More information about the wine-devel mailing list