element: inline the recursice state lock
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 2 Jun 2011 12:09:46 +0000 (14:09 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 2 Jun 2011 12:09:46 +0000 (14:09 +0200)
gst/gstelement.c
gst/gstelement.h

index 4f28c18..1a01a4d 100644 (file)
@@ -285,8 +285,7 @@ gst_element_init (GstElement * element)
   GST_STATE_RETURN (element) = GST_STATE_CHANGE_SUCCESS;
 
   /* FIXME 0.11: Store this directly in the instance struct */
-  element->state_lock = g_slice_new (GStaticRecMutex);
-  g_static_rec_mutex_init (element->state_lock);
+  g_static_rec_mutex_init (&element->state_lock);
   element->state_cond = g_cond_new ();
 }
 
@@ -2915,14 +2914,8 @@ gst_element_finalize (GObject * object)
 
   GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize");
 
-  GST_STATE_LOCK (element);
-  if (element->state_cond)
-    g_cond_free (element->state_cond);
-  element->state_cond = NULL;
-  GST_STATE_UNLOCK (element);
-  g_static_rec_mutex_free (element->state_lock);
-  g_slice_free (GStaticRecMutex, element->state_lock);
-  element->state_lock = NULL;
+  g_cond_free (element->state_cond);
+  g_static_rec_mutex_free (&element->state_lock);
 
   GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize parent");
 
index 0fc81ad..538201f 100644 (file)
@@ -487,7 +487,7 @@ G_STMT_START {                                                          \
  * This lock is used by the core.  It is taken while getting or setting
  * the state, during state changes, and while finalizing.
  */
-#define GST_STATE_GET_LOCK(elem)               (GST_ELEMENT_CAST(elem)->state_lock)
+#define GST_STATE_GET_LOCK(elem)               (&(GST_ELEMENT_CAST(elem)->state_lock))
 /**
  * GST_STATE_GET_COND:
  * @elem: a #GstElement
@@ -544,7 +544,7 @@ struct _GstElement
   GstObject             object;
 
   /*< public >*/ /* with LOCK */
-  GStaticRecMutex      *state_lock;
+  GStaticRecMutex       state_lock;
 
   /* element state */
   GCond                *state_cond;