2005-11-04 Wim Taymans <wim@fluendo.com>
+ * gst/gstbus.c: (gst_bus_post), (gst_bus_set_sync_handler):
+ Don't leak a mutex unlock in case of an error.
+
+ * gst/gstbus.h:
+ Doc fixes.
+
+2005-11-04 Wim Taymans <wim@fluendo.com>
+
* gst/gstbus.c: (gst_bus_class_init), (gst_bus_init),
(gst_bus_post):
Get the context to wake up only once.
* function is usually only called by the creator of the bus. Applications
* should handle messages asynchronously using the gst_bus watch and poll
* functions.
+ *
+ * You cannot replace an existing sync_handler. You can pass NULL to this
+ * function, which will clear the existing handler.
*/
void
gst_bus_set_sync_handler (GstBus * bus, GstBusSyncHandler func, gpointer data)
/* Assert if the user attempts to replace an existing sync_handler,
* other than to clear it */
- g_assert (func == NULL || bus->sync_handler == NULL);
+ if (func != NULL && bus->sync_handler != NULL)
+ goto no_replace;
bus->sync_handler = func;
bus->sync_handler_data = data;
GST_UNLOCK (bus);
+
+ return;
+
+no_replace:
+ {
+ GST_UNLOCK (bus);
+ g_warning ("cannot replace existing sync handler");
+ return;
+ }
}
/* GSource for the bus
* into the bus. This function is mostly used internally. Only one sync handler
* can be attached to a given bus.
*
+ * If the handler returns GST_BUS_DROP, it should unref the message, else the
+ * message should not be unreffed by the sync handler.
+ *
* Returns: #GstBusSyncReply stating what to do with the message
*/
typedef GstBusSyncReply (*GstBusSyncHandler) (GstBus * bus, GstMessage * message, gpointer data);