aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates/qquickstackview.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-06 11:16:05 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-07 05:19:39 +0100
commit1bcf85bd38684ef4d993c56264a95b965ed936c7 (patch)
tree2e107a16c3172bd31626fd50f84c86e289fb6d4f /src/quicktemplates/qquickstackview.cpp
parent93fd421fdac96adfc33ecca974ee21fcdfbdb7b9 (diff)
StackView: guard against destruction of previous item during transition
Since user code might get called during the transition when an item gets popped, the previous item might be destroyed already by the time the transition completes. Guard against that using a QPointer. Add a test case. Fixes: QTBUG-118525 Change-Id: If412f279a395a217a5b45352b11ae850e00ca58b Reviewed-by: Ed Cooke <ed.cooke@qt.io> Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates/qquickstackview.cpp')
-rw-r--r--src/quicktemplates/qquickstackview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates/qquickstackview.cpp b/src/quicktemplates/qquickstackview.cpp
index a09d0ef4f1..f13dd20c24 100644
--- a/src/quicktemplates/qquickstackview.cpp
+++ b/src/quicktemplates/qquickstackview.cpp
@@ -731,7 +731,7 @@ void QQuickStackView::pop(QQmlV4Function *args)
}
#endif
- QQuickItem *previousItem = nullptr;
+ QPointer<QQuickItem> previousItem;
if (d->popElements(enter)) {
if (exit) {