Jactry Zeng : riched20/tests: Lock hGlobal before use.

Alexandre Julliard julliard at winehq.org
Mon Jun 7 16:30:37 CDT 2021


Module: wine
Branch: master
Commit: f9c8c95856ded333be35ff41ab40a246bfe345b6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f9c8c95856ded333be35ff41ab40a246bfe345b6

Author: Jactry Zeng <jzeng at codeweavers.com>
Date:   Sat May 29 22:01:37 2021 +0800

riched20/tests: Lock hGlobal before use.

Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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);




More information about the wine-cvs mailing list