]> git.sesse.net Git - vlc/commitdiff
UIs: call XInitThreads if using X11
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 21 Feb 2010 08:58:10 +0000 (10:58 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 21 Feb 2010 08:58:10 +0000 (10:58 +0200)
This is needed to protect the Xlib internal state. Xlib may still be
used by user interface thread, the GLX video output thread(s) and
PulseAudio -audio thread- while it initializes.

Fortunately, we do not need to lock X11 displays as every thread uses
its own. Hopefully Xlib is not buggy in that respect, but I am not so
sure :(

This should fix LP #419915.

modules/gui/hildon/maemo.c
modules/gui/qt4/qt4.cpp

index 4809d49c830ebb42858e91c62892cba5bfbe7475..e22e982fd75d04fda509c8a2dc6d711d34faea1d 100644 (file)
@@ -81,6 +81,9 @@ static int Open( vlc_object_t *p_this )
     intf_sys_t *p_sys;;
     vlc_value_t val;
 
+    if( !XInitThreads() )
+        return VLC_EGENERIC;
+
     /* Allocate instance and initialize some members */
     p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
index 19bfafa4ed2debfe86a8f6241ecabb2ccdf10278..b70275616a616707552562ed2b6c23262f70f69d 100644 (file)
@@ -287,6 +287,8 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
 #ifdef Q_WS_X11
+    if( !XInitThreads() )
+        return VLC_EGENERIC;
     x11_display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
     Display *p_display = XOpenDisplay( x11_display );
     if( !p_display )