Bug 555313 – GFileAttribute boxed type get_type function should use
authorChristian Persch <chpe@src.gnome.org>
Wed, 8 Oct 2008 20:54:39 +0000 (20:54 +0000)
committerChristian Persch <chpe@src.gnome.org>
Wed, 8 Oct 2008 20:54:39 +0000 (20:54 +0000)
usual get_type pattern

svn path=/trunk/; revision=7580

ChangeLog
gio/gfileattribute.c

index f4fc6ab..ff93dc8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-10-08  Christian Persch  <chpe@gnome.org>
 
+        Bug 555313 – GFileAttribute boxed type get_type function should
+        use usual get_type pattern
+
+        * gio/gfileattribute.c (g_file_attribute_info_list_get_type): Use
+        g_once_init_enter/leave.
+
+2008-10-08  Christian Persch  <chpe@gnome.org>
+
         Bug 555314 – mem leak in gmarkup
 
         * glib/gmarkup.c: (g_markup_parse_context_parse): Plug a mem leak.
index bea20da..76bdf61 100644 (file)
@@ -329,13 +329,19 @@ _g_file_attribute_value_dup (const GFileAttributeValue *other)
 GType
 g_file_attribute_info_list_get_type (void)
 {
-  static GType type_id = 0;
+  static volatile gsize g_define_type_id__volatile = 0;
 
-  if (!type_id)
-    type_id = g_boxed_type_register_static (g_intern_static_string ("GFileAttributeInfoList"),
-                                           (GBoxedCopyFunc) g_file_attribute_info_list_dup,
-                                           (GBoxedFreeFunc) g_file_attribute_info_list_unref);
-  return type_id;
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      GType g_define_type_id =
+        g_boxed_type_register_static (I_("GFileAttributeInfoList"),
+                                      (GBoxedCopyFunc) g_file_attribute_info_list_dup,
+                                      (GBoxedFreeFunc) g_file_attribute_info_list_unref);
+
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
 }
 
 static gboolean