Commit 882fff21 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: synchronize X display

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

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
parent 61c5a86a
...@@ -45,6 +45,15 @@ ...@@ -45,6 +45,15 @@
#ifdef Q_WS_X11 #ifdef Q_WS_X11
# include <X11/Xlib.h> # include <X11/Xlib.h>
# include <qx11info_x11.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 #endif
#include <math.h> #include <math.h>
...@@ -113,6 +122,8 @@ WId VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y, ...@@ -113,6 +122,8 @@ WId VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
return NULL; return NULL;
} }
p_vout = p_nvout; p_vout = p_nvout;
videoSync();
#ifndef NDEBUG #ifndef NDEBUG
msg_Dbg( p_intf, "embedded video ready (handle %p)", (void *)winId() ); msg_Dbg( p_intf, "embedded video ready (handle %p)", (void *)winId() );
#endif #endif
...@@ -129,6 +140,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h ) ...@@ -129,6 +140,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h )
videoSize.rheight() = h; videoSize.rheight() = h;
if( !isVisible() ) show(); if( !isVisible() ) show();
updateGeometry(); // Needed for deinterlace updateGeometry(); // Needed for deinterlace
videoSync();
} }
void VideoWidget::release( void ) void VideoWidget::release( void )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment