Kevin Puetz : ole32/tests: Fix flaky test in cowait_unmarshal_thread.

Alexandre Julliard julliard at
Mon Nov 9 15:11:51 CST 2020

Module: wine
Branch: master
Commit: 54f04370ebd11abfd305fbc23ca0200cc329d278

Author: Kevin Puetz <PuetzKevinA at>
Date:   Thu Nov  5 17:09:11 2020 -0600

ole32/tests: Fix flaky test in cowait_unmarshal_thread.

When run with runtest -q (WINETEST_DEBUG=0) it passed within the
first 50ms, but with any verbose logging it sometimes failed.

Use CoWaitForMultipleHandles (which keeps pumping the STA) since
cowait_unmarshal_thread only releases its marshaled unk at the end,
so it needs to be able to call back in order to exit cleanly.

Signed-off-by: Kevin Puetz <PuetzKevinA at>
Signed-off-by: Alexandre Julliard <julliard at>


 dlls/ole32/tests/compobj.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 5ed3f9638b1..0d7f3d8adee 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -2772,8 +2772,9 @@ static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
     ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
     hr = CoWaitForMultipleHandles(0, 50, 1, &event, &index);
     ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    index = WaitForSingleObject(thread, 200);
-    ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
+    hr = CoWaitForMultipleHandles(0, 200, 1, &thread, &index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+    ok(index == WAIT_OBJECT_0, "cowait_unmarshal_thread didn't finish");
     hr = CoRegisterMessageFilter(NULL, NULL);

More information about the wine-cvs mailing list