aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-12-13 12:41:49 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-12-17 07:24:28 +0000
commitc401ae278b4bb91c70c6d7df974a241d7c68855b (patch)
tree7f810406f519e9a157ae27b006cdb292843b55e4 /src
parentaad66998c379deba70aceda27c09d4680bbf10ff (diff)
QML: When destroying a context, clear any pointers to it
The "context" pointer in QQmlData can either point to ownContext, or to outerContext. In the latter case we need to clear it when the outerContext is destroyed. Fixes: QTBUG-72527 Change-Id: Ifbf358d405d6cec9868f67184ef887d1b70c90bc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlcontext.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index eca00ffb51..3710cee162 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -640,6 +640,8 @@ void QQmlContextData::destroy()
QQmlData *co = contextObjects;
contextObjects = contextObjects->nextContextObject;
+ if (co->context == this)
+ co->context = nullptr;
co->outerContext = nullptr;
co->nextContextObject = nullptr;
co->prevContextObject = nullptr;