Commit 826fdf52 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Call XInitThreads early enough

We need to call XInitThreads before anyone tries XOpenDisplay or
something, and XInitThreads itself is not re-entrant, so call it before
we start LibVLC. This only "fixes" Xlib with VLC. Other LibVLC users
need to do something similar themselves. LibVLC cannot do it. Other
application may have already connected to X before it starts LibVLC.
(cherry picked from commit 364868f9)

Conflicts:

	bin/vlc.c
	configure.ac
parent 1d65f646
......@@ -33,7 +33,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
#endif
/* Explicit HACK */
extern void LocaleFree (const char *);
......@@ -86,6 +88,15 @@ int main( int i_argc, const char *ppsz_argv[] )
/* FIXME: rootwrap (); */
#endif
#ifdef HAVE_X11_XLIB_H
/* Initialize Xlib thread support. */
if (!XInitThreads ())
{
fputs ("VLC requires a thread-safe Xlib. Sorry.\n", stderr);
return 1;
}
#endif
/* Synchronously intercepted POSIX signals.
*
* In a threaded program such as VLC, the only sane way to handle signals
......
......@@ -3947,6 +3947,8 @@ if test "${enable_x11}" != "no" &&
test "${enable_x11}" = "yes"); then
CPPFLAGS="${CPPFLAGS_save} ${X_FLAGS}"
AC_CHECK_HEADERS(X11/Xlib.h, [
VLC_ADD_CPPFLAGS([vlc], [${X_CFLAGS}])
VLC_ADD_LIBS([vlc], [${X_LIBS} ${X_PRE_LIBS} -lX11])
VLC_ADD_PLUGIN([panoramix])
VLC_ADD_LIBS([panoramix],[${X_LIBS} ${X_PRE_LIBS} -lX11])
VLC_ADD_CPPFLAGS([panoramix],[${X_CFLAGS}])
......
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