[PATCH v2 2/2] server: Do not detach windows if they are owned by another thread.
Rémi Bernon
rbernon at codeweavers.com
Thu Nov 7 10:27:46 CST 2019
On thread destroy, a WM_WINE_DESTROYWINDOW is sent for the children
windows owned by other threads. However there's then a race condition
between these threads peeking for messages and the current thread
detaching its child windows from their owning threads -which clears
their message queues.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/tests/msg.c | 3 +--
server/window.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 2f3f70076e9..c7d61e4df07 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -8779,7 +8779,6 @@ static void test_interthread_messages(void)
SetEvent( wnd_event.child_stopped_event );
ret = WaitForSingleObject( wnd_event.grand_child, 5000 );
- todo_wine
ok( !ret, "WaitForSingleObject failed %x\n", ret );
CloseHandle( wnd_event.grand_child );
@@ -8787,7 +8786,7 @@ static void test_interthread_messages(void)
CloseHandle( wnd_event.stop_event );
CloseHandle( wnd_event.child_stopped_event );
flush_events();
- ok_sequence(WmExitThreadSeq, "destroy child on thread exit", TRUE);
+ ok_sequence(WmExitThreadSeq, "destroy child on thread exit", FALSE);
log_all_parent_messages--;
DestroyWindow( wnd_event.hwnd );
diff --git a/server/window.c b/server/window.c
index c9b131cba5d..3985ea4eb20 100644
--- a/server/window.c
+++ b/server/window.c
@@ -1914,7 +1914,7 @@ void destroy_window( struct window *win )
post_message( win->parent->handle, WM_PARENTNOTIFY, WM_DESTROY, win->handle );
}
- detach_window_thread( win );
+ if (win->thread == current) detach_window_thread( win );
if (win->win_region) free_region( win->win_region );
if (win->update_region) free_region( win->update_region );
if (win->class) release_class( win->class );
--
2.24.0.rc2
More information about the wine-devel
mailing list