aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2017-07-25 13:14:21 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-07-25 12:26:33 +0000
commit9c515a6de24bc8d5709136cc099ceeae8e3e642c (patch)
tree18420a862f38dab6dff9339af92b1169f031591c /src/qml/types
parent6b8695dbdbb381566c28d5d10d9de14e8eb99205 (diff)
Do not (dis)connectNotify on dynamically created model item objects
These item objects are direct subclasses of QObject, and cannot override connectNotify/disconnectNotify. This prevents the creation of the backing QMetaObject during disconnect, which happens during destruction, which in turn will call back into the model that is being destroyed. Task-number: QTBUG-59704 Change-Id: I7f997e5d2fda242b38e67b9147224d72aa4508ba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmllistmodel.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 4d8f213284..9d0f1afb32 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1361,13 +1361,9 @@ ReturnedValue ModelObject::get(const Managed *m, String *name, bool *hasProperty
if (QQmlEngine *qmlEngine = that->engine()->qmlEngine()) {
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(qmlEngine);
- if (ep && ep->propertyCapture) {
- QObjectPrivate *op = QObjectPrivate::get(that->object());
- // Temporarily hide the dynamic meta-object, to prevent it from being created when the capture
- // triggers a QObject::connectNotify() by calling obj->metaObject().
- QScopedValueRollback<QDynamicMetaObjectData*> metaObjectBlocker(op->metaObject, 0);
- ep->propertyCapture->captureProperty(that->object(), -1, role->index);
- }
+ if (ep && ep->propertyCapture)
+ ep->propertyCapture->captureProperty(that->object(), -1, role->index,
+ QQmlPropertyCapture::OnlyOnce, false);
}
const int elementIndex = that->d()->m_elementIndex;