Zebediah Figura : quartz/videorenderer: Create the window on the same thread as the filter.

Alexandre Julliard julliard at winehq.org
Thu Oct 3 16:44:00 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Oct  2 22:01:08 2019 -0500

quartz/videorenderer: Create the window on the same thread as the filter.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/filtergraph.c |  2 +-
 dlls/quartz/videorenderer.c     | 47 +----------------------------------------
 2 files changed, 2 insertions(+), 47 deletions(-)

diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index f93f355b60..b6e9f3ab0f 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -4095,7 +4095,7 @@ static void test_window_threading(void)
     if ((hwnd = get_renderer_hwnd(graph)))
     {
         tid = GetWindowThreadProcessId(hwnd, NULL);
-        todo_wine ok(tid == GetCurrentThreadId(), "Window should be created on main thread.\n");
+        ok(tid == GetCurrentThreadId(), "Window should be created on main thread.\n");
     }
     else
         skip("Could not find renderer window.\n");
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c
index 429b59bfe3..87ff9f59bf 100644
--- a/dlls/quartz/videorenderer.c
+++ b/dlls/quartz/videorenderer.c
@@ -45,11 +45,8 @@ typedef struct VideoRendererImpl
     IOverlay IOverlay_iface;
 
     BOOL init;
-    HANDLE hThread;
 
-    DWORD ThreadID;
     HANDLE hEvent;
-    BOOL ThreadResult;
     RECT SourceRect;
     RECT DestRect;
     RECT WindowPos;
@@ -83,54 +80,15 @@ static inline VideoRendererImpl *impl_from_BaseControlVideo(BaseControlVideo *if
     return CONTAINING_RECORD(iface, VideoRendererImpl, baseControlVideo);
 }
 
-static DWORD WINAPI MessageLoop(LPVOID lpParameter)
-{
-    VideoRendererImpl* This = lpParameter;
-    MSG msg; 
-    BOOL fGotMessage;
-
-    TRACE("Starting message loop\n");
-
-    if (FAILED(BaseWindowImpl_PrepareWindow(&This->baseControlWindow.baseWindow)))
-    {
-        This->ThreadResult = FALSE;
-        SetEvent(This->hEvent);
-        return 0;
-    }
-
-    This->ThreadResult = TRUE;
-    SetEvent(This->hEvent);
-
-    while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
-    {
-        TranslateMessage(&msg); 
-        DispatchMessageW(&msg);
-    }
-
-    TRACE("End of message loop\n");
-
-    return msg.wParam;
-}
-
 static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
 {
     This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
     if (!This->hEvent)
         return FALSE;
 
-    This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
-    if (!This->hThread)
-    {
-        CloseHandle(This->hEvent);
-        return FALSE;
-    }
-
-    WaitForSingleObject(This->hEvent, INFINITE);
-
-    if (!This->ThreadResult)
+    if (FAILED(BaseWindowImpl_PrepareWindow(&This->baseControlWindow.baseWindow)))
     {
         CloseHandle(This->hEvent);
-        CloseHandle(This->hThread);
         return FALSE;
     }
 
@@ -379,9 +337,6 @@ static void video_renderer_destroy(BaseRenderer *iface)
 
     BaseControlWindow_Destroy(&filter->baseControlWindow);
     BaseControlVideo_Destroy(&filter->baseControlVideo);
-    PostThreadMessageW(filter->ThreadID, WM_QUIT, 0, 0);
-    WaitForSingleObject(filter->hThread, INFINITE);
-    CloseHandle(filter->hThread);
     CloseHandle(filter->hEvent);
 
     strmbase_renderer_cleanup(&filter->renderer);




More information about the wine-cvs mailing list