From d02e1d7f7d3c0dcb8fd707614c180614cbf6ea02 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sat, 8 Oct 2016 17:23:08 +0200 Subject: [PATCH] bin: Fix iterator resync'ing When we get GST_ITERATOR_RESYNC, we need to call gst_iterator_resync() otherwise we will always get GST_ITERATOR_RESYNC (and that loop would run forever). --- gst/gstbin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gst/gstbin.c b/gst/gstbin.c index 820488b001..a64db779b8 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -3109,10 +3109,13 @@ undo: GST_DEBUG_OBJECT (element, "Bin failed to change state, switching children back to %s", gst_element_state_get_name (current)); - do { + while (TRUE) { ret = gst_iterator_foreach (it, &reset_state, GINT_TO_POINTER (current)); - } while (ret == GST_ITERATOR_RESYNC); + if (ret != GST_ITERATOR_RESYNC) + break; + gst_iterator_resync (it); + } gst_iterator_free (it); } goto done;