bin: Make sure to free all cached messages when going to NULL
authorSebastian Dröge <sebastian@centricular.com>
Sat, 17 Oct 2015 19:13:08 +0000 (22:13 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 20 Oct 2015 07:16:38 +0000 (10:16 +0300)
An ASYNC READY->PAUSED might have failed without the bin code noticing during
the state change, in which case we will never get PAUSED->READY and would leak
messages.

https://bugzilla.gnome.org/show_bug.cgi?id=756611

gst/gstbin.c

index 9cea0b3..87eac49 100644 (file)
@@ -2630,6 +2630,11 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition)
         goto activate_failure;
       break;
     case GST_STATE_NULL:
+      /* Clear message list on next NULL */
+      GST_OBJECT_LOCK (bin);
+      GST_DEBUG_OBJECT (element, "clearing all cached messages");
+      bin_remove_messages (bin, NULL, GST_MESSAGE_ANY);
+      GST_OBJECT_UNLOCK (bin);
       if (current == GST_STATE_READY) {
         GList *l;