[PATCH 1/2] mciqtz: Dispatch messages while waiting on command completion.

Andrew Eikum aeikum at codeweavers.com
Wed Apr 27 14:05:11 CDT 2016


Without this, we can hit a deadlock if the task thread tries to call a
SendMessage on a window owned by the calling thread.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/mciqtz32/mciqtz.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c
index 4e559b6..6627910 100644
--- a/dlls/mciqtz32/mciqtz.c
+++ b/dlls/mciqtz32/mciqtz.c
@@ -90,8 +90,17 @@ static LRESULT MCIQTZ_relayTaskMessage(DWORD_PTR dwDevID, UINT wMsg,
     SetEvent(wma->task.notify);
     handles[0] = wma->task.done;
     handles[1] = wma->task.thread;
-    ret = WaitForMultipleObjects(sizeof(handles)/sizeof(handles[0]), handles,
-                                 FALSE, INFINITE);
+
+    while ((ret = MsgWaitForMultipleObjects(sizeof(handles)/sizeof(handles[0]),
+                    handles, FALSE, INFINITE, QS_ALLINPUT)) == WAIT_OBJECT_0 + 2)
+    {
+        MSG msg;
+        while (PeekMessageW( &msg, NULL, 0, 0, PM_REMOVE ))
+        {
+            TranslateMessage( &msg );
+            DispatchMessageW( &msg );
+        }
+    }
     if (ret == WAIT_OBJECT_0)
         res = wma->task.res;
     else
-- 
2.8.0





More information about the wine-patches mailing list