quartz/filtergraph: Ensure that the thread has a message queue before posting messages to it.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-10-09 23:15:10 -05:00 committed by Alexandre Julliard
parent 44cbb55815
commit 2b45d0fefe
1 changed files with 6 additions and 1 deletions

View File

@ -987,6 +987,10 @@ static DWORD WINAPI message_thread_run(void *ctx)
IFilterGraphImpl *graph = ctx; IFilterGraphImpl *graph = ctx;
MSG msg; 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); CoInitializeEx(NULL, COINIT_MULTITHREADED);
for (;;) for (;;)
@ -5686,8 +5690,9 @@ static HRESULT filter_graph_common_create(IUnknown *outer, void **out, BOOL thre
if (threaded) 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_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 else
fimpl->message_thread = NULL; fimpl->message_thread = NULL;