summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2015-08-18 19:55:13 +0100
committerBehdad Esfahbod <behdad@behdad.org>2015-08-18 19:55:45 +0100
commit927585ea24482ec880fc8e1dcb63eade313f6d46 (patch)
treedb7622ee140126f71fe897ac6089db8ec4e7cae4
parentf5c12f8d8f39f405426e6cef153f91cdfe409710 (diff)
downloadpango-927585ea24482ec880fc8e1dcb63eade313f6d46.tar.gz
Serialize call to th_brk()
Libthai is not threadsafe (thought it probably can easily be made to be). As such, add mutex around th_brk() calls. test-pangocairo-threads passes again.
-rw-r--r--pango/break-thai.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pango/break-thai.c b/pango/break-thai.c
index e7462999..4a2d7d7a 100644
--- a/pango/break-thai.c
+++ b/pango/break-thai.c
@@ -26,6 +26,8 @@
#include <thai/thwchar.h>
#include <thai/thbrk.h>
+G_LOCK_DEFINE_STATIC (th_brk);
+
/*
* tis_text is assumed to be large enough to hold the converted string,
* i.e. it must be at least g_utf8_strlen(text, len)+1 bytes.
@@ -73,7 +75,10 @@ break_thai (const char *text,
brk_pnts = g_new (int, cnt);
/* find line break positions */
+
+ G_LOCK (th_brk);
len = th_brk (tis_text, brk_pnts, len);
+ G_UNLOCK (th_brk);
for (cnt = 0; cnt < len; cnt++)
{
attrs[brk_pnts[cnt]].is_line_break = TRUE;