[PATCH v2 1/2] strmbase: Do not notify the parent of the window's destruction.

Gabriel Ivăncescu gabrielopcode at gmail.com
Fri Jan 10 06:23:52 CST 2020

Fixes a regression introduced by
3b5198c8283d891095612c1001edb5e5788d6059. Media Player Classic deadlocks when
the window is destroyed, because DestroyWindow will notify the parent, which
is on a different thread and waiting on a signal from the filter's thread.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>

Tests (next patch) also show that Windows does not notify the parent either,
despite not having the style set prior to destruction (without this patch,
the test would fail on Wine).

 dlls/strmbase/window.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c
index 07a12ec..d646f7e 100644
--- a/dlls/strmbase/window.c
+++ b/dlls/strmbase/window.c
@@ -77,6 +77,13 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM
         This->Width = LOWORD(lparam);
         This->Height = HIWORD(lparam);
+        break;
+    case WM_CLOSE:
+        /* Some applications like Media Player Classic deadlock when the parent,
+           which is on a different thread, is notified before the destruction.
+           Windows also doesn't notify it, despite not having the style prior. */
+        SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW(hwnd, GWL_EXSTYLE) | WS_EX_NOPARENTNOTIFY);
+        break;
     return DefWindowProcW(hwnd, message, wparam, lparam);

More information about the wine-devel mailing list