mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
gstdevicemonitor: added cleanup of signal handlers and hidden providers list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2182>
This commit is contained in:
parent
af78c16dd5
commit
cf684051dd
1 changed files with 19 additions and 3 deletions
|
@ -132,6 +132,14 @@ static void gst_device_monitor_dispose (GObject * object);
|
|||
static guint gst_device_monitor_add_filter_unlocked (GstDeviceMonitor * monitor,
|
||||
const gchar * classes, GstCaps * caps);
|
||||
|
||||
static void
|
||||
provider_hidden (GstDeviceProvider * provider, const gchar * hidden,
|
||||
GstDeviceMonitor * monitor);
|
||||
|
||||
static void
|
||||
provider_unhidden (GstDeviceProvider * provider, const gchar * hidden,
|
||||
GstDeviceMonitor * monitor);
|
||||
|
||||
struct DeviceFilter
|
||||
{
|
||||
guint id;
|
||||
|
@ -319,7 +327,7 @@ gst_device_monitor_init (GstDeviceMonitor * self)
|
|||
|
||||
|
||||
static void
|
||||
gst_device_monitor_remove (GstDeviceMonitor * self, guint i)
|
||||
gst_device_monitor_remove_provider (GstDeviceMonitor * self, guint i)
|
||||
{
|
||||
GstDeviceProvider *provider = g_ptr_array_index (self->priv->providers, i);
|
||||
GstBus *bus;
|
||||
|
@ -330,6 +338,9 @@ gst_device_monitor_remove (GstDeviceMonitor * self, guint i)
|
|||
g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self);
|
||||
gst_object_unref (bus);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (provider, provider_hidden, self);
|
||||
g_signal_handlers_disconnect_by_func (provider, provider_unhidden, self);
|
||||
|
||||
gst_object_unref (provider);
|
||||
}
|
||||
|
||||
|
@ -342,7 +353,7 @@ gst_device_monitor_dispose (GObject * object)
|
|||
|
||||
if (self->priv->providers) {
|
||||
while (self->priv->providers->len)
|
||||
gst_device_monitor_remove (self, self->priv->providers->len - 1);
|
||||
gst_device_monitor_remove_provider (self, self->priv->providers->len - 1);
|
||||
g_ptr_array_unref (self->priv->providers);
|
||||
self->priv->providers = NULL;
|
||||
}
|
||||
|
@ -352,6 +363,11 @@ gst_device_monitor_dispose (GObject * object)
|
|||
self->priv->filters = NULL;
|
||||
}
|
||||
|
||||
if (self->priv->hidden) {
|
||||
g_list_free_full (self->priv->hidden, g_free);
|
||||
self->priv->hidden = NULL;
|
||||
}
|
||||
|
||||
gst_object_replace ((GstObject **) & self->priv->bus, NULL);
|
||||
|
||||
G_OBJECT_CLASS (gst_device_monitor_parent_class)->dispose (object);
|
||||
|
@ -774,7 +790,7 @@ gst_device_monitor_remove_filter (GstDeviceMonitor * monitor, guint filter_id)
|
|||
}
|
||||
|
||||
if (!valid) {
|
||||
gst_device_monitor_remove (monitor, i);
|
||||
gst_device_monitor_remove_provider (monitor, i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue