[vlc-commits] commit: --no-xlib: prevent use of XInitThreads() and hence Xlib ( Rémi Denis-Courmont )
git at videolan.org
git at videolan.org
Wed Jun 2 20:39:28 CEST 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Jun 2 21:30:49 2010 +0300| [95c95cc91ac583b76582b63dfd6c95ca5fdde592] | committer: Rémi Denis-Courmont
--no-xlib: prevent use of XInitThreads() and hence Xlib
Certain LibVLC applications fail to call XInitThreads() before they
call XOpenDisplay(). Then VLC calls XInitThreads(). Then the
applications call XCloseDisplay(), which raises a segmentation fault.
In this case, Xlib tries acquire lock that was never created as the
Display ppinter was created before threaded Xlib mode was enabled.
These applications can now pass --no-xlib to libvlc_new(). This will
prevent any VLC Xlib-based plugin from being used. Currently, this
affects interfaces (not really an issue), PulseAudio (until Colin's
patch is merged upstream) and GLX (Xlib-based by design).
This will be necessary to address #3662.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=95c95cc91ac583b76582b63dfd6c95ca5fdde592
---
modules/audio_output/pulse.c | 2 +-
modules/gui/hildon/maemo.c | 2 +-
modules/gui/qt4/qt4.cpp | 2 +-
modules/gui/skins2/x11/x11_factory.cpp | 5 ++++-
modules/video_output/xcb/glx.c | 2 +-
src/libvlc-module.c | 2 ++
6 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index f36ec09..a064ff3 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -124,7 +124,7 @@ static int Open ( vlc_object_t *p_this )
#ifdef X_DISPLAY_MISSING
# error Xlib required due to PulseAudio bug 799!
#else
- if( !XInitThreads() )
+ if( !var_InheritBool( p_this, "xlib" ) || !XInitThreads() )
return VLC_EGENERIC;
#endif
/* Allocate structures */
diff --git a/modules/gui/hildon/maemo.c b/modules/gui/hildon/maemo.c
index 14c51f6..640069d 100644
--- a/modules/gui/hildon/maemo.c
+++ b/modules/gui/hildon/maemo.c
@@ -80,7 +80,7 @@ static int Open( vlc_object_t *p_this )
intf_sys_t *p_sys;
vlc_value_t val;
- if( !XInitThreads() )
+ if( !var_InheritBool( p_this, "xlib" ) || !XInitThreads() )
return VLC_EGENERIC;
/* Allocate instance and initialize some members */
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 1e75a08..6d13f5b 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -283,7 +283,7 @@ 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() )
+ if( !var_InheritBool( p_this, "xlib" ) || !XInitThreads() )
return VLC_EGENERIC;
char *display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
diff --git a/modules/gui/skins2/x11/x11_factory.cpp b/modules/gui/skins2/x11/x11_factory.cpp
index fa54582..5d09402 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -57,8 +57,11 @@ X11Factory::~X11Factory()
bool X11Factory::init()
{
// make sure xlib is safe-thread
- if( !XInitThreads() )
+ if( !var_InheritBool( getIntf(), "xlib" ) || !XInitThreads() )
+ {
msg_Err( getIntf(), "initializing xlib for multi-threading failed" );
+ return false;
+ }
// Create the X11 display
m_pDisplay = new X11Display( getIntf() );
diff --git a/modules/video_output/xcb/glx.c b/modules/video_output/xcb/glx.c
index f67d9f6..7598cd1 100644
--- a/modules/video_output/xcb/glx.c
+++ b/modules/video_output/xcb/glx.c
@@ -203,7 +203,7 @@ static int CreateWindow (vout_display_t *vd, xcb_connection_t *conn,
*/
static int Open (vlc_object_t *obj)
{
- if (!XInitThreads ())
+ if (!var_InheritBool (obj, "xlib") || !XInitThreads ())
return VLC_EGENERIC;
vout_display_t *vd = (vout_display_t *)obj;
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 363c102..280db3f 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -1641,6 +1641,8 @@ vlc_module_begin ()
DISPLAY_TEXT, DISPLAY_LONGTEXT, true )
add_deprecated_alias( "xvideo-display" ) /* deprecated since 1.1.0 */
add_deprecated_alias( "glx-display" )
+ add_bool( "xlib", true, NULL, "", "", true )
+ change_private ()
add_bool( "drop-late-frames", 1, NULL, DROP_LATE_FRAMES_TEXT,
DROP_LATE_FRAMES_LONGTEXT, true )
/* Used in vout_synchro */
More information about the vlc-commits
mailing list