gboolean
gst_bus_remove_watch (GstBus * bus)
{
- GSource *watch_id;
+ GSource *source;
g_return_val_if_fail (GST_IS_BUS (bus), FALSE);
goto error;
}
- watch_id = bus->priv->signal_watch;
+ source =
+ bus->priv->signal_watch ? g_source_ref (bus->priv->signal_watch) : NULL;
GST_OBJECT_UNLOCK (bus);
- g_source_destroy (watch_id);
+ if (source) {
+ g_source_destroy (source);
+ g_source_unref (source);
+ }
return TRUE;
GST_DEBUG_OBJECT (bus, "removing signal watch %u",
g_source_get_id (bus->priv->signal_watch));
- source = bus->priv->signal_watch;
+ source =
+ bus->priv->signal_watch ? g_source_ref (bus->priv->signal_watch) : NULL;
done:
GST_OBJECT_UNLOCK (bus);
- if (source)
+ if (source) {
g_source_destroy (source);
+ g_source_unref (source);
+ }
return;