From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/event.c | 4 ++++ dlls/winex11.drv/window.c | 9 ++++----- dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index c13762996fc..ab2d0117238 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -180,6 +180,10 @@ static BOOL host_window_filter_event( XEvent *event )
switch (event->type) { + case DestroyNotify: + TRACE( "host window %p/%lx DestroyNotify\n", win, win->window ); + win->destroyed = TRUE; + break; case ReparentNotify: { XReparentEvent *reparent = (XReparentEvent *)event; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 159759161bc..5c424b13791 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -127,10 +127,13 @@ static void host_window_release( struct host_window *win )
void host_window_destroy( struct host_window *win ) { + struct x11drv_thread_data *data = x11drv_thread_data(); + TRACE( "host window %p/%lx\n", win, win->window );
list_remove( &win->entry ); if (win->parent) host_window_release( win->parent ); + if (!win->destroyed) XSelectInput( data->display, win->window, 0 ); free( win->children ); free( win ); } @@ -178,6 +181,7 @@ struct host_window *get_host_window( Window window, BOOL create ) win->window = window;
X11DRV_expect_error( data->display, host_window_error, NULL ); + XSelectInput( data->display, window, StructureNotifyMask ); if (!XGetWindowAttributes( data->display, window, &attr )) memset( &attr, 0, sizeof(attr) ); if (!XQueryTree( data->display, window, &xroot, &xparent, &xchildren, &nchildren )) xparent = root_window; else XFree( xchildren ); @@ -1862,7 +1866,6 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des Window xwin = (Window)NtUserGetProp( data->hwnd, foreign_window_prop ); if (xwin) { - if (!already_destroyed) XSelectInput( data->display, xwin, 0 ); XDeleteContext( data->display, xwin, winContext ); NtUserRemoveProp( data->hwnd, foreign_window_prop ); } @@ -2268,13 +2271,9 @@ HWND create_foreign_window( Display *display, Window xwin ) if (XFindContext( display, xwin, winContext, (char **)&hwnd )) hwnd = 0; if (hwnd) return hwnd; /* already created */
- XSelectInput( display, xwin, StructureNotifyMask ); if (!XGetWindowAttributes( display, xwin, &attr ) || !XQueryTree( display, xwin, &xroot, &xparent, &xchildren, &nchildren )) - { - XSelectInput( display, xwin, 0 ); return 0; - } XFree( xchildren );
if (xparent == xroot) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 16a5ef75356..214e843d028 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -367,6 +367,7 @@ struct host_window struct list entry; LONG refcount; Window window; + BOOL destroyed; /* host window has already been destroyed */ RECT rect; /* host window rect, relative to parent */ struct host_window *parent; unsigned int children_count;