summaryrefslogtreecommitdiff
path: root/src/hb-shaper.cc
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2018-06-26 11:15:52 +0900
committerYoungbok Shin <youngb.shin@samsung.com>2018-06-26 11:15:52 +0900
commitb9f425ddd6223cd82b3d35f13fbd060d3c0c0e38 (patch)
tree87220edcaa6118811d062d77d0562a3f74c7f885 /src/hb-shaper.cc
parent1c272a48507bb3c7905aa30d8bf0d092b474f781 (diff)
downloadharfbuzz-b9f425ddd6223cd82b3d35f13fbd060d3c0c0e38.tar.gz
harfbuzz-b9f425ddd6223cd82b3d35f13fbd060d3c0c0e38.tar.bz2
harfbuzz-b9f425ddd6223cd82b3d35f13fbd060d3c0c0e38.zip
Imported Upstream version 1.8.1upstream/1.8.1
Diffstat (limited to 'src/hb-shaper.cc')
-rw-r--r--src/hb-shaper.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hb-shaper.cc b/src/hb-shaper.cc
index 2c44cf2..d44d8c9 100644
--- a/src/hb-shaper.cc
+++ b/src/hb-shaper.cc
@@ -44,8 +44,13 @@ static const hb_shaper_pair_t *static_shapers;
static
void free_static_shapers (void)
{
- if (unlikely (static_shapers != all_shapers))
- free ((void *) static_shapers);
+retry:
+ hb_shaper_pair_t *shapers = (hb_shaper_pair_t *) hb_atomic_ptr_get (&static_shapers);
+ if (!hb_atomic_ptr_cmpexch (&static_shapers, shapers, nullptr))
+ goto retry;
+
+ if (unlikely (shapers != all_shapers))
+ free ((void *) shapers);
}
#endif