gst/gstbus.c: Don't leak a mutex unlock in case of an error.

Original commit message from CVS:
* 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.
This commit is contained in:
Wim Taymans 2005-11-04 12:08:19 +00:00
parent ea9dd6099a
commit bb6d55f37c
3 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,11 @@
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),

View file

@ -522,6 +522,9 @@ gst_bus_peek (GstBus * bus)
* 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)
@ -532,11 +535,21 @@ 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

View file

@ -77,6 +77,9 @@ typedef enum
* 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);