[PATCH v2 5/5] quartz/filtergraph: Ensure that the thread has a message queue before posting messages to it.

Zebediah Figura z.figura12 at gmail.com
Wed Oct 9 23:15:10 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
Fixes hangs like <http://test.winehq.org/data/71e96bd3b757a2b058b6a769c341d81f82329d79/linux_cw-gtx560-t32/quartz:filtergraph.html>.

 dlls/quartz/filtergraph.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 0808ec9d6c8..47ce5af59d1 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -990,6 +990,10 @@ static DWORD WINAPI message_thread_run(void *ctx)
     IFilterGraphImpl *graph = ctx;
     MSG msg;
 
+    /* Make sure we have a message queue. */
+    PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE);
+    SetEvent(graph->message_thread_ret);
+
     CoInitializeEx(NULL, COINIT_MULTITHREADED);
 
     for (;;)
@@ -5728,8 +5732,9 @@ static HRESULT filter_graph_common_create(IUnknown *outer, void **out, BOOL thre
 
     if (threaded)
     {
-        fimpl->message_thread = CreateThread(NULL, 0, message_thread_run, fimpl, 0, &fimpl->message_thread_id);
         fimpl->message_thread_ret = CreateEventW(NULL, FALSE, FALSE, NULL);
+        fimpl->message_thread = CreateThread(NULL, 0, message_thread_run, fimpl, 0, &fimpl->message_thread_id);
+        WaitForSingleObject(fimpl->message_thread_ret, INFINITE);
     }
     else
         fimpl->message_thread = NULL;
-- 
2.23.0




More information about the wine-devel mailing list