From 927585ea24482ec880fc8e1dcb63eade313f6d46 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 18 Aug 2015 19:55:13 +0100 Subject: 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. --- pango/break-thai.c | 5 +++++ 1 file changed, 5 insertions(+) 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 #include +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; -- cgit v1.2.1