aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontext.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-10-14 14:06:06 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-10-16 08:19:56 +0200
commit03196c9a0f1635ce78cf53addb6b688108f66fae (patch)
tree8f7d484419d80cfcb1a70bf98763ca43041dc41f /src/qml/qml/qqmlcontext.cpp
parent383854f482a34cef14f918c2a3172522249ef542 (diff)
Check for invalid context in QQmlContextPrivate::dropDestroyedQObject
If the context is invalid we won't be able to look up the object by name anymore. In that case there is nothing to do. Fixes: QTBUG-78326 Change-Id: I011ccb6b02a84725c1d5eae24b494516ae2d5fee Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlcontext.cpp')
-rw-r--r--src/qml/qml/qqmlcontext.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index af8deb085c..f75a076bcb 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -532,6 +532,9 @@ QObject *QQmlContextPrivate::context_at(QQmlListProperty<QObject> *prop, int ind
void QQmlContextPrivate::dropDestroyedQObject(const QString &name, QObject *destroyed)
{
+ if (!data->isValid())
+ return;
+
const int idx = data->propertyNames().value(name);
Q_ASSERT(idx >= 0);
if (qvariant_cast<QObject *>(propertyValues[idx]) != destroyed)