diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-05-23 08:30:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-05-23 08:30:25 (GMT) |
commit | 87bf3a06657cebfa60f9342700840162a8053df5 (patch) | |
tree | 8d7a4dd933cb624ade75995443ca4b51f07eb6db /unix/tkUnixEvent.c | |
parent | e1e1944517d89e734f0a5068ac86cd7f2395841c (diff) | |
parent | 586b77aea13cf6128fc8d09fbfff887ab9838545 (diff) | |
download | tk-87bf3a06657cebfa60f9342700840162a8053df5.zip tk-87bf3a06657cebfa60f9342700840162a8053df5.tar.gz tk-87bf3a06657cebfa60f9342700840162a8053df5.tar.bz2 |
Fix for [3613668] by not calling XInitThreads when either 1) Tcl is compiled without threads 2) X11 library is too old.
A more direct test would be more desirable, but for now this should be fine.
Diffstat (limited to 'unix/tkUnixEvent.c')
-rw-r--r-- | unix/tkUnixEvent.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 9b32502..b7f8f75 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -128,7 +128,7 @@ TkpOpenDisplay( int minor = 0; int reason = 0; unsigned int use_xkb = 0; -#ifdef TCL_THREADS +#if defined(XKEYCODETOKEYSYM_IS_DEPRECATED) && defined(TCL_THREADS) static int xinited = 0; TCL_DECLARE_MUTEX(xinitMutex); @@ -137,8 +137,12 @@ TkpOpenDisplay( if (!xinited) { /* Necessary for threaded apps, of no consequence otherwise */ /* need only be called once, but must be called before *any* */ - /* Xlib call is made. */ - XInitThreads(); + /* Xlib call is made. If xinitMutex is still NULL after the */ + /* Tcl_MutexLock call, Tcl was compiled without threads so */ + /* we cannot use XInitThreads() either. */ + if (xinitMutex != NULL){ + XInitThreads(); + } xinited = 1; } Tcl_MutexUnlock(&xinitMutex); |