[pango] Make static data thread safe in pango-context.c



commit a4eeee8e222db740ca83d29217d707db1160ada8
Author: Alessandro Pignotti <a pignotti sssup it>
Date:   Wed May 25 16:04:22 2011 +0200

    Make static data thread safe in pango-context.c

 pango/pango-context.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-context.c b/pango/pango-context.c
index a909cd0..cdb6a53 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1368,8 +1368,8 @@ string_from_script (PangoScript script)
 {
   static GEnumClass *class = NULL;
   GEnumValue *value;
-  if (!class)
-    class = g_type_class_ref (PANGO_TYPE_SCRIPT);
+  if (g_once_init_enter ((gsize*)&class))
+    g_once_init_leave((gsize*)&class, (gsize)g_type_class_ref (PANGO_TYPE_SCRIPT));
 
   value = g_enum_get_value (class, script);
   if (!value)



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