gstbin: Use g_queue_clear_full()

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>
This commit is contained in:
Jan Schmidt 2022-10-01 04:58:04 +10:00 committed by GStreamer Marge Bot
parent 8f91f1efe4
commit 92efecd1fe

View file

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