From b94889f49170e3d8df5b348d3f179445d892f232 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 26 Jul 2017 13:07:17 +0200 Subject: Fix QQuickStackViewPrivate::viewItemTransitionFinished() ~QQuickStackElement() emits QQuickStackViewAttached::removed(), which may be used to modify the stack. Set the status first and make a copy of the destroyable stack elements to exclude any modifications that may happen during the loop. Task-number: QTBUG-62153 Change-Id: I144acd693519e637b78f9a2d910e83da8f2d779e Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickstackview_p.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/quicktemplates2/qquickstackview_p.cpp') diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp index 3c983d6b..0b0f5ef5 100644 --- a/src/quicktemplates2/qquickstackview_p.cpp +++ b/src/quicktemplates2/qquickstackview_p.cpp @@ -278,9 +278,13 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition } if (transitioner->runningJobs.isEmpty()) { - qDeleteAll(removed); - removed.clear(); + // ~QQuickStackElement() emits QQuickStackViewAttached::removed(), which may be used + // to modify the stack. Set the status first and make a copy of the destroyable stack + // elements to exclude any modifications that may happen during the loop. (QTBUG-62153) setBusy(false); + QList elements = removed; + removed.clear(); + qDeleteAll(elements); } removing.remove(element); -- cgit v1.2.3