[vlc-devel] commit: Qt4: synchronize X display ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Aug 13 18:12:27 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Thu Aug 13 19:10:09 2009 +0300| [882fff211a1b20d17ecda577063d4e07b7396c2e] | committer: Rémi Denis-Courmont 

Qt4: synchronize X display

This should fix spurious BadWindow errors from the video displays.
(cherry-picked from commit 1c201d4807e95194fa6964a6f7954d0042952a6b)

There has been a few X11 error crash reports against 1.0, though I do
not know if this will fix them (could be another problem). Basically,
XFlush() is insufficient, as it does not ensure that the X server has
processed the requests.

Conflicts:

	modules/gui/qt4/components/interface_widgets.cpp

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=882fff211a1b20d17ecda577063d4e07b7396c2e
---

 modules/gui/qt4/components/interface_widgets.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 6b35a36..895d528 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -45,6 +45,15 @@
 #ifdef Q_WS_X11
 # include <X11/Xlib.h>
 # include <qx11info_x11.h>
+static void videoSync( void )
+{
+    /* Make sure the X server has processed all requests.
+     * This protects other threads using distinct connections from getting
+     * the video widget window in an inconsistent states. */
+    XSync( QX11Info::display(), False );
+}
+#else
+# define videoSync() (void)0
 #endif
 
 #include <math.h>
@@ -113,6 +122,8 @@ WId VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
         return NULL;
     }
     p_vout = p_nvout;
+
+    videoSync();
 #ifndef NDEBUG
     msg_Dbg( p_intf, "embedded video ready (handle %p)", (void *)winId() );
 #endif
@@ -129,6 +140,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h )
     videoSize.rheight() = h;
     if( !isVisible() ) show();
     updateGeometry(); // Needed for deinterlace
+    videoSync();
 }
 
 void VideoWidget::release( void )




More information about the vlc-devel mailing list