gstreamer_core/gst/gstinterface.c
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gstreamer_core/gst/gstinterface.c	Fri Mar 19 09:35:09 2010 +0200
+++ b/gstreamer_core/gst/gstinterface.c	Fri Apr 16 15:15:52 2010 +0300
@@ -51,9 +51,10 @@
 GType
 gst_implements_interface_get_type (void)
 {
-  static GType gst_interface_type = 0;
+  static volatile gsize gst_interface_type = 0;
 
-  if (!gst_interface_type) {
+  if (g_once_init_enter (&gst_interface_type)) {
+    GType _type;
     static const GTypeInfo gst_interface_info = {
       sizeof (GstImplementsInterfaceClass),
       (GBaseInitFunc) gst_implements_interface_class_init,
@@ -67,10 +68,11 @@
       NULL
     };
 
-    gst_interface_type = g_type_register_static (G_TYPE_INTERFACE,
+    _type = g_type_register_static (G_TYPE_INTERFACE,
         "GstImplementsInterface", &gst_interface_info, 0);
 
-    g_type_interface_add_prerequisite (gst_interface_type, GST_TYPE_ELEMENT);
+    g_type_interface_add_prerequisite (_type, GST_TYPE_ELEMENT);
+    g_once_init_leave (&gst_interface_type, _type);
   }
 
   return gst_interface_type;
@@ -188,15 +190,11 @@
 gboolean
 gst_implements_interface_check (gpointer from, GType type)
 {
-  GstImplementsInterface *iface;
-
   /* check cast, return FALSE if it fails, don't give a warning... */
   if (!G_TYPE_CHECK_INSTANCE_TYPE (from, type)) {
     return FALSE;
   }
 
-  iface = G_TYPE_CHECK_INSTANCE_CAST (from, type, GstImplementsInterface);
-
   /* now, if we're an element (or derivative), is this thing
    * actually implemented for real? */
   if (GST_IS_ELEMENT (from)) {