summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-21 13:47:43 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-07-21 13:47:43 +0000
commit804ef7674724a1bb801778ee031fc0db261d4dfc (patch)
tree33569d89b89de0648eeb0a79e4cba4e247a404f8
parent2a253d9bc76c0333e424aa0200a212b3fc57ab33 (diff)
parent2743d99312fcf5831e924e1a7089712aeab54f38 (diff)
downloadpango-804ef7674724a1bb801778ee031fc0db261d4dfc.tar.gz
Merge branch 'thai' into 'main'
Use GMutex for the shared thai brk See merge request GNOME/pango!378
-rw-r--r--pango/break-thai.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/pango/break-thai.c b/pango/break-thai.c
index 85b9e54a..871c0869 100644
--- a/pango/break-thai.c
+++ b/pango/break-thai.c
@@ -27,8 +27,10 @@
#include <thai/thwchar.h>
#include <thai/thbrk.h>
-#ifndef HAVE_TH_BRK_FIND_BREAKS
-G_LOCK_DEFINE_STATIC (th_brk);
+G_LOCK_DEFINE_STATIC (thai_brk);
+
+#ifdef HAVE_TH_BRK_FIND_BREAKS
+static ThBrk *thai_brk = NULL;
#endif
/*
@@ -79,13 +81,15 @@ break_thai (const char *text,
/* find line break positions */
+ G_LOCK (thai_brk);
#ifdef HAVE_TH_BRK_FIND_BREAKS
- len = th_brk_find_breaks(NULL, tis_text, brk_pnts, cnt);
+ if (thai_brk == NULL)
+ thai_brk = th_brk_new(NULL);
+ len = th_brk_find_breaks(thai_brk, tis_text, brk_pnts, cnt);
#else
- G_LOCK (th_brk);
len = th_brk (tis_text, brk_pnts, cnt);
- G_UNLOCK (th_brk);
#endif
+ G_UNLOCK (thai_brk);
for (cnt = 0; cnt < len; cnt++)
if (attrs[brk_pnts[cnt]].is_char_break)