[PATCH libX11 2/3] Don't cache last lcd in _XlcCurrentLC.

Jacek Caban jacek at codeweavers.com
Mon Aug 14 17:20:19 UTC 2017


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

The way it's currently cached is not thread safe. As long as locale doesn't change, the same object is reused anyway.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
 src/xlibi18n/lcWrap.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/src/xlibi18n/lcWrap.c b/src/xlibi18n/lcWrap.c
index 43b4d622..5339dcf3 100644
--- a/src/xlibi18n/lcWrap.c
+++ b/src/xlibi18n/lcWrap.c
@@ -352,17 +352,7 @@ _XCloseLC(
 XLCd
 _XlcCurrentLC(void)
 {
-    XLCd lcd;
-    static XLCd last_lcd = NULL;
-
-    lcd = _XOpenLC((char *) NULL);
-
-    if (last_lcd)
-	_XCloseLC(last_lcd);
-
-    last_lcd = lcd;
-
-    return lcd;
+    return _XOpenLC(NULL);
 }
 
 XrmMethods
-- 
2.13.0



More information about the xorg-devel mailing list