From 8caf9b7a8744a6a6ae617f6d27f8cb7f17acccdc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 16 Jul 2015 17:25:24 +0200 Subject: [PATCH] devicemonitor: keep order of providers and devices The deviceproviders are added to the array sorted by their rank. Make sure we keep this ordering when removing a provider. We use _prepend to collect the devices, use g_list_reverse to get the devices in the right order; sorted by rank and in the same order as returned by the provider. --- gst/gstdevicemonitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c index b055934467..994263a45c 100644 --- a/gst/gstdevicemonitor.c +++ b/gst/gstdevicemonitor.c @@ -209,7 +209,7 @@ gst_device_monitor_remove (GstDeviceMonitor * self, guint i) GstDeviceProvider *provider = g_ptr_array_index (self->priv->providers, i); GstBus *bus; - g_ptr_array_remove_index_fast (self->priv->providers, i); + g_ptr_array_remove_index (self->priv->providers, i); bus = gst_device_provider_get_bus (provider); g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self); @@ -324,7 +324,7 @@ again: GST_OBJECT_UNLOCK (monitor); - return devices; + return g_list_reverse (devices); } /**