Index: gst/gstobject.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstobject.c,v
retrieving revision 1.80.2.1
diff -c -p -r1.80.2.1 gstobject.c
*** gst/gstobject.c	26 Apr 2005 02:01:52 -0000	1.80.2.1
--- gst/gstobject.c	27 Jul 2005 13:20:17 -0000
*************** enum
*** 57,62 ****
--- 57,63 ----
  
  GType _gst_object_type = 0;
  static GHashTable *object_name_counts = NULL;
+ static GMutex *ref_lock;
  
  G_LOCK_DEFINE_STATIC (object_name_mutex);
  
*************** gst_object_class_init (GstObjectClass * 
*** 174,179 ****
--- 175,182 ----
  #ifndef GST_DISABLE_TRACE
    gobject_class->constructor = gst_object_constructor;
  #endif
+ 
+   ref_lock = g_mutex_new();
  }
  
  static void
*************** gst_object_ref (GstObject * object)
*** 222,231 ****
--- 225,236 ----
  {
    g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
  
+   g_mutex_lock(ref_lock);
    GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "ref %d->%d",
        G_OBJECT (object)->ref_count, G_OBJECT (object)->ref_count + 1);
  
    g_object_ref (G_OBJECT (object));
+   g_mutex_unlock(ref_lock);
    return object;
  }
  
*************** void
*** 240,251 ****
--- 245,258 ----
  gst_object_unref (GstObject * object)
  {
    g_return_if_fail (GST_IS_OBJECT (object));
+   g_mutex_lock(ref_lock);
    g_return_if_fail (G_OBJECT (object)->ref_count > 0);
  
    GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unref %d->%d",
        G_OBJECT (object)->ref_count, G_OBJECT (object)->ref_count - 1);
  
    g_object_unref (G_OBJECT (object));
+   g_mutex_unlock(ref_lock);
  }
  
  /**
