[PATCH libX11] Always initialise thread support

Daniel Stone daniel at fooishbar.org
Fri Jul 12 14:25:38 PDT 2013

Make XOpenDisplay always call XInitThreads when opening a display, thus
guarding it against possible disaster scenarios like calling
XOpenDisplay without XInitThreads, then passing the Display pointer into
an EGL library which uses threads.  Or any of the other five similar
failure scenarios I've seen just this week.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
 src/OpenDis.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/OpenDis.c b/src/OpenDis.c
index fc67d1a..2104845 100644
--- a/src/OpenDis.c
+++ b/src/OpenDis.c
@@ -87,6 +87,8 @@ XOpenDisplay (
 	long int conn_buf_size;
 	char *xlib_buffer_size;
+        XInitThreads();
 	 * If the display specifier string supplied as an argument to this
 	 * routine is NULL or a pointer to NULL, read the DISPLAY variable.

More information about the xorg-devel mailing list