From cf6df7947bd5e62b99788cf9862b312c5b3d5599 Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Fri, 13 Mar 2009 20:43:54 +0100 Subject: [PATCH] X11: make sure base window is really destroyed... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ...before calling release function of the window provider (only way to prevent possible BadWindow xlib error) Signed-off-by: Rémi Denis-Courmont --- modules/video_output/x11/xcommon.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c index cd89701fa4..b241025194 100644 --- a/modules/video_output/x11/xcommon.c +++ b/modules/video_output/x11/xcommon.c @@ -1863,6 +1863,20 @@ static void DestroyWindow( vout_thread_t *p_vout, x11_window_t *p_win ) XUnmapWindow( p_vout->p_sys->p_display, p_win->base_window ); XDestroyWindow( p_vout->p_sys->p_display, p_win->base_window ); + /* make sure base window is destroyed before proceeding further */ + bool b_destroy_notify = false; + do + { + XEvent xevent; + XWindowEvent( p_vout->p_sys->p_display, p_win->base_window, + SubstructureNotifyMask | StructureNotifyMask, &xevent); + if( (xevent.type == DestroyNotify) + && (xevent.xmap.window == p_win->base_window) ) + { + b_destroy_notify = true; + } + } while( !b_destroy_notify ); + vout_ReleaseWindow( p_win->owner_window ); } -- 2.39.2