gst/gstbin.c: Check that the state_cookie hasn't changed since the continue_func...
authorJan Schmidt <thaytan@mad.scientist.com>
Wed, 18 Jul 2007 14:31:21 +0000 (14:31 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Wed, 18 Jul 2007 14:31:21 +0000 (14:31 +0000)
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_continue_func):
Check that the state_cookie hasn't changed since the continue_func
was scheduled. Avoids problems where the state changes back to
something it shouldn't be because it was changed in the meantime.

ChangeLog
gst/gstbin.c

index 9945bec..1a0272d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-18  Jan Schmidt  <thaytan@noraisin.net>
+
+       * gst/gstbin.c: (gst_bin_continue_func):
+       Check that the state_cookie hasn't changed since the continue_func
+       was scheduled. Avoids problems where the state changes back to
+       something it shouldn't be because it was changed in the meantime.
+
 2007-07-17  Stefan Kost  <ensonic@users.sf.net>
 
        * gst/gstregistrybinary.c: (gst_registry_binary_save_const_string),
index 3cb2f46..99d2ae4 100644 (file)
@@ -2220,6 +2220,9 @@ gst_bin_continue_func (BinContinueData * data)
   GST_DEBUG_OBJECT (bin, "doing state continue");
   GST_OBJECT_LOCK (bin);
 
+  if (data->cookie != GST_ELEMENT_CAST (bin)->state_cookie)
+    goto interrupted;
+
   current = GST_STATE (bin);
   next = GST_STATE_GET_NEXT (current, pending);
   transition = (GstStateChange) GST_STATE_TRANSITION (current, next);
@@ -2240,6 +2243,14 @@ gst_bin_continue_func (BinContinueData * data)
   GST_DEBUG_OBJECT (bin, "state continue done");
   gst_object_unref (bin);
   g_free (data);
+  return;
+
+interrupted:
+  GST_OBJECT_UNLOCK (bin);
+  GST_STATE_UNLOCK (bin);
+  GST_DEBUG_OBJECT (bin, "state continue aborted due to intervening change");
+  gst_object_unref (bin);
+  g_free (data);
 }
 
 static GstBusSyncReply