]> git.sesse.net Git - vlc/commitdiff
X11: make sure base window is really destroyed...
authorErwan Tulou <brezhoneg1@yahoo.fr>
Fri, 13 Mar 2009 19:43:54 +0000 (20:43 +0100)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 15 Mar 2009 18:24:27 +0000 (20:24 +0200)
...before calling release function of the window provider
(only way to prevent possible BadWindow xlib error)

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
modules/video_output/x11/xcommon.c

index cd89701fa4d66b02ae62dbdbdef3b6b4ac21309b..b241025194f11d720d57ac22409ef8187d358747 100644 (file)
@@ -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 );
 }