Commit e056b580 authored by Rémi Denis-Courmont's avatar 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.
parent a5a49b4e
...@@ -81,6 +81,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -81,6 +81,9 @@ static int Open( vlc_object_t *p_this )
intf_sys_t *p_sys;; intf_sys_t *p_sys;;
vlc_value_t val; vlc_value_t val;
if( !XInitThreads() )
return VLC_EGENERIC;
/* Allocate instance and initialize some members */ /* Allocate instance and initialize some members */
p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL ) if( p_intf->p_sys == NULL )
......
...@@ -287,6 +287,8 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider ) ...@@ -287,6 +287,8 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
intf_thread_t *p_intf = (intf_thread_t *)p_this; intf_thread_t *p_intf = (intf_thread_t *)p_this;
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if( !XInitThreads() )
return VLC_EGENERIC;
x11_display = var_CreateGetNonEmptyString( p_intf, "x11-display" ); x11_display = var_CreateGetNonEmptyString( p_intf, "x11-display" );
Display *p_display = XOpenDisplay( x11_display ); Display *p_display = XOpenDisplay( x11_display );
if( !p_display ) if( !p_display )
......
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