gst/gstbin.c: Make default message forwarding from child->bus to bin->bus threadsafe...
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 8 Aug 2005 13:17:07 +0000 (13:17 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Mon, 8 Aug 2005 13:17:07 +0000 (13:17 +0000)
Original commit message from CVS:
* gst/gstbin.c: (bin_bus_handler):
Make default message forwarding from child->bus to bin->bus
threadsafe and make it not emit warnings if the parent has no bus.

ChangeLog
gst/gstbin.c

index 411b74c..30199db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-08-08  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
+       * gst/gstbin.c: (bin_bus_handler):
+         Make default message forwarding from child->bus to bin->bus
+         threadsafe and make it not emit warnings if the parent has no bus.
+
+2005-08-08  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
        * gst/gstelement.c: (activate_pads):
          On paused->ready, set pad->caps to NULL, as is the documented
          behaviour in this state change. Fixes playback of series of
index 4fa1c42..410ca5e 100644 (file)
@@ -1468,11 +1468,24 @@ bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin)
       gst_message_unref (message);
       break;
     }
-    default:
+    default:{
+      GstBus *bus;
+
       /* Send all other messages upward */
-      GST_DEBUG_OBJECT (bin, "posting message upward");
-      gst_bus_post (GST_ELEMENT (bin)->bus, message);
+      GST_LOCK (bin);
+      if (!(bus = GST_ELEMENT (bin)->bus)) {
+        GST_DEBUG_OBJECT (bin, "dropping message because no parent bus");
+        GST_UNLOCK (bin);
+      } else {
+        gst_object_ref (bus);
+        GST_UNLOCK (bin);
+
+        GST_DEBUG_OBJECT (bin, "posting message upward");
+        gst_bus_post (GST_ELEMENT (bin)->bus, message);
+        gst_object_unref (bus);
+      }
       break;
+    }
   }
 
   return GST_BUS_DROP;