[pango] Make static data thread safe in pangoft2-fontmap.c
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] Make static data thread safe in pangoft2-fontmap.c
- Date: Tue, 28 Aug 2012 04:34:17 +0000 (UTC)
commit 43f077b4bd6710b27645add20af26234e0266052
Author: Alessandro Pignotti <a pignotti sssup it>
Date: Wed May 25 16:55:58 2011 +0200
Make static data thread safe in pangoft2-fontmap.c
pango/pangoft2-fontmap.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index 3da0f16..c3a8439 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]