summaryrefslogtreecommitdiff
path: root/src/locking.c
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2017-08-14 19:20:20 +0200
committerKeith Packard <keithp@keithp.com>2020-11-09 08:47:35 -0800
commitb52ba5c209165fc2c533b77b86147b31763299f3 (patch)
treebe5988d958eb4afc585aabfd67429b6266ba1856 /src/locking.c
parent8b5ce3a9b1219c81711944880e5a1e1cfad3d956 (diff)
downloadxorg-lib-libX11-b52ba5c209165fc2c533b77b86147b31763299f3.tar.gz
Make conv_list thread safe.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=55678 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=68538 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69088 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Martin Peres <martin.peres@mupuf.org>
Diffstat (limited to 'src/locking.c')
-rw-r--r--src/locking.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/locking.c b/src/locking.c
index 9f4fe067..3981c0f5 100644
--- a/src/locking.c
+++ b/src/locking.c
@@ -66,6 +66,8 @@ in this Software without prior written authorization from The Open Group.
/* in lcWrap.c */
extern LockInfoPtr _Xi18n_lock;
+/* in lcConv.c */
+extern LockInfoPtr _conv_lock;
#ifdef WIN32
static DWORD _X_TlsIndex = (DWORD)-1;
@@ -98,6 +100,7 @@ static xthread_t _Xthread_self(void)
static LockInfoRec global_lock;
static LockInfoRec i18n_lock;
+static LockInfoRec conv_lock;
static void _XLockMutex(
LockInfoPtr lip
@@ -594,12 +597,22 @@ Status XInitThreads(void)
global_lock.lock = NULL;
return 0;
}
+ if (!(conv_lock.lock = xmutex_malloc())) {
+ xmutex_free(global_lock.lock);
+ global_lock.lock = NULL;
+ xmutex_free(i18n_lock.lock);
+ i18n_lock.lock = NULL;
+ return 0;
+ }
_Xglobal_lock = &global_lock;
xmutex_init(_Xglobal_lock->lock);
xmutex_set_name(_Xglobal_lock->lock, "Xlib global");
_Xi18n_lock = &i18n_lock;
xmutex_init(_Xi18n_lock->lock);
xmutex_set_name(_Xi18n_lock->lock, "Xlib i18n");
+ _conv_lock = &conv_lock;
+ xmutex_init(_conv_lock->lock);
+ xmutex_set_name(_conv_lock->lock, "Xlib conv");
_XLockMutex_fn = _XLockMutex;
_XUnlockMutex_fn = _XUnlockMutex;
_XCreateMutex_fn = _XCreateMutex;