=== modified file 'gst/gstminiobject.c'
--- gst/gstminiobject.c	2009-08-18 14:15:32 +0000
+++ gst/gstminiobject.c	2009-11-10 16:48:29 +0000
@@ -326,12 +326,14 @@
 {
   GstMiniObjectClass *mo_class;
 
+  gst_mini_object_ref (mini_object);
+
   mo_class = GST_MINI_OBJECT_GET_CLASS (mini_object);
   mo_class->finalize (mini_object);
 
   /* if the refcount is still 0 we can really free the
    * object, else the finalize method recycled the object */
-  if (g_atomic_int_get (&mini_object->refcount) == 0) {
+  if (G_LIKELY (g_atomic_int_dec_and_test (&mini_object->refcount))) {
 #ifndef GST_DISABLE_TRACE
     gst_alloc_trace_free (_gst_mini_object_trace, mini_object);
 #endif

