[vlc-devel] commit: UIs: call XInitThreads if using X11 ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Feb 21 10:10:26 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 21 10:58:10 2010 +0200| [e056b5805aabed93d484dd92131463b760261b89] | committer: Rémi Denis-Courmont 

UIs: call XInitThreads if using X11

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.

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

 modules/gui/hildon/maemo.c |    3 +++
 modules/gui/qt4/qt4.cpp    |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/gui/hildon/maemo.c b/modules/gui/hildon/maemo.c
index 4809d49..e22e982 100644
--- a/modules/gui/hildon/maemo.c
+++ b/modules/gui/hildon/maemo.c
@@ -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 )
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 19bfafa..b702756 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -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 )




More information about the vlc-devel mailing list