summaryrefslogtreecommitdiff
path: root/pango/pangoft2-fontmap.c
diff options
context:
space:
mode:
authorAlessandro Pignotti <a.pignotti@sssup.it>2011-05-25 16:55:58 +0200
committerBehdad Esfahbod <behdad@behdad.org>2012-08-27 23:33:39 -0400
commit43f077b4bd6710b27645add20af26234e0266052 (patch)
tree10527f8e0be88da1981fba7e5d92eb6d9d494cd4 /pango/pangoft2-fontmap.c
parent503ad16e979dae995ed200e512d734fa6691ecef (diff)
downloadpango-43f077b4bd6710b27645add20af26234e0266052.tar.gz
Make static data thread safe in pangoft2-fontmap.c
Diffstat (limited to 'pango/pangoft2-fontmap.c')
-rw-r--r--pango/pangoft2-fontmap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index 3da0f165..c3a8439b 100644
--- a/pango/pangoft2-fontmap.c
+++ b/pango/pangoft2-fontmap.c
@@ -269,10 +269,8 @@ pango_ft2_get_context (double dpi_x, double dpi_y)
PangoFontMap *
pango_ft2_font_map_for_display (void)
{
- if (pango_ft2_global_fontmap != NULL)
- return PANGO_FONT_MAP (pango_ft2_global_fontmap);
-
- pango_ft2_global_fontmap = (PangoFT2FontMap *)pango_ft2_font_map_new ();
+ if (g_once_init_enter ((gsize*)&pango_ft2_global_fontmap))
+ g_once_init_leave((gsize*)&pango_ft2_global_fontmap, (gsize)pango_ft2_font_map_new ());
return PANGO_FONT_MAP (pango_ft2_global_fontmap);
}