[pango] Serialize call to th_brk()



commit 927585ea24482ec880fc8e1dcb63eade313f6d46
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Aug 18 19:55:13 2015 +0100

    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 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/pango/break-thai.c b/pango/break-thai.c
index e746299..4a2d7d7 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]