gstbin: Use g_queue_clear_full()
authorJan Schmidt <jan@centricular.com>
Fri, 30 Sep 2022 18:58:04 +0000 (04:58 +1000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 4 Oct 2022 11:19:14 +0000 (11:19 +0000)
Use g_queue_clear_full() to release the child list
instead of iterating over the list twice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3101>

subprojects/gstreamer/gst/gstbin.c

index 4233841..19b0fa6 100644 (file)
@@ -1123,8 +1123,7 @@ gst_bin_do_deep_add_remove (GstBin * bin, gint sig_id, const gchar * sig_name,
     do {
       ires = gst_iterator_foreach (it, bin_deep_iterator_foreach, &elements);
       if (ires != GST_ITERATOR_DONE) {
-        g_queue_foreach (&elements, (GFunc) gst_object_unref, NULL);
-        g_queue_clear (&elements);
+        g_queue_clear_full (&elements, (GDestroyNotify) gst_object_unref);
       }
       if (ires == GST_ITERATOR_RESYNC)
         gst_iterator_resync (it);