[PATCH libX11] Always initialise thread support

Jamey Sharp jamey at minilop.net
Fri Jul 12 14:40:19 PDT 2013


Hmm. XInitThreads wasn't designed to be used this way. For instance,
initializing thread support isn't thread-safe, for fairly obvious
reasons.

This patch might mask more bugs than it causes, and thereby be a net
win. But it seems equally likely to turn out the other way.

I'd suggest an awful lot of caution here.

Jamey

On Fri, Jul 12, 2013 at 10:25:38PM +0100, Daniel Stone wrote:
> 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.
> -- 
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20130712/93a2643d/attachment.pgp>


More information about the xorg-devel mailing list