[PATCH libX11] Always initialise thread support

Mark Kettenis mark.kettenis at xs4all.nl
Sun Jul 14 09:17:19 PDT 2013


> From: Daniel Stone <daniel at fooishbar.org>
> Date: Fri, 12 Jul 2013 22:25:38 +0100
> 
> 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.

Isn't the real solution to these problems to change the EGL library to
use xcb?

Forcing the overhead of per-request locking down everybodies throat
isn't very nice, even if the overhead is relatively small.

> 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.
> -- 
> 1.8.3.1
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list