aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-11-22 10:25:27 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-11-22 12:15:15 +0100
commit662ab7ebdad0e6c32278f2fcf9a5e43a11681b09 (patch)
treeaa3aced53fb3bec4c46b0d7a195938556ee4536c /src/qmlmodels
parent744e77b841878fb017c0f2d60607090008f28180 (diff)
QQmlDelegateModel: Set extraObject only if required properties given
Otherwise we would set the same object as extraObject and as contextObject. That spells trouble when tearing down the context. Fixes: QTBUG-79958 Change-Id: I97fd0bf111304d06cff35eda46d4b4c6eefdaccc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlmodels')
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index 531ba18a4b..9cfc80ba4e 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -937,13 +937,14 @@ void PropertyUpdater::breakBinding()
void QQDMIncubationTask::initializeRequiredProperties(QQmlDelegateModelItem *modelItemToIncubate, QObject *object)
{
auto incubatorPriv = QQmlIncubatorPrivate::get(this);
- QQmlData *d = QQmlData::get(object);
- auto contextData = d ? d->context : nullptr;
- if (contextData) {
- contextData->hasExtraObject = true;
- contextData->extraObject = modelItemToIncubate;
- }
if (incubatorPriv->hadRequiredProperties()) {
+ QQmlData *d = QQmlData::get(object);
+ auto contextData = d ? d->context : nullptr;
+ if (contextData) {
+ contextData->hasExtraObject = true;
+ contextData->extraObject = modelItemToIncubate;
+ }
+
if (incubatorPriv->requiredProperties().empty())
return;
RequiredProperties &requiredProperties = incubatorPriv->requiredProperties();