aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-24 01:00:15 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-24 01:00:15 +0100
commit73894987a22c9821c508c921f38a0db442559c71 (patch)
tree15182a0090157a9b6621e2688ca6b44963962ee6 /src/qmlmodels
parent8aa13799516bb412908a5612da5ea5ba0972b998 (diff)
parent861f53d60cc2dd8bd8529c65863af881dbdd8db8 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'src/qmlmodels')
-rw-r--r--src/qmlmodels/qqmldelegatemodel.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp
index 710cc359b4..646ac5e9f9 100644
--- a/src/qmlmodels/qqmldelegatemodel.cpp
+++ b/src/qmlmodels/qqmldelegatemodel.cpp
@@ -269,13 +269,23 @@ QQmlDelegateModel::~QQmlDelegateModel()
cacheItem->contextData->invalidate();
cacheItem->contextData = nullptr;
cacheItem->scriptRef -= 1;
+ } else if (cacheItem->incubationTask) {
+ // Both the incubationTask and the object may hold a scriptRef,
+ // but if both are present, only one scriptRef is held in total.
+ cacheItem->scriptRef -= 1;
}
+
cacheItem->groups &= ~Compositor::UnresolvedFlag;
cacheItem->objectRef = 0;
+
+ if (cacheItem->incubationTask) {
+ d->releaseIncubator(cacheItem->incubationTask);
+ cacheItem->incubationTask->vdm = nullptr;
+ cacheItem->incubationTask = nullptr;
+ }
+
if (!cacheItem->isReferenced())
delete cacheItem;
- else if (cacheItem->incubationTask)
- cacheItem->incubationTask->vdm = nullptr;
}
}
@@ -641,7 +651,7 @@ QQmlDelegateModel::ReleaseFlags QQmlDelegateModel::release(QObject *item, QQmlIn
void QQmlDelegateModel::cancel(int index)
{
Q_D(QQmlDelegateModel);
- if (!d->m_delegate || index < 0 || index >= d->m_compositor.count(d->m_compositorGroup)) {
+ if (index < 0 || index >= d->m_compositor.count(d->m_compositorGroup)) {
qWarning() << "DelegateModel::cancel: index out range" << index << d->m_compositor.count(d->m_compositorGroup);
return;
}
@@ -936,15 +946,18 @@ void PropertyUpdater::breakBinding()
return;
if (updateCount == 0) {
QObject::disconnect(*it);
+ senderToConnection.erase(it);
QQmlError warning;
- warning.setUrl(qmlContext(QObject::sender())->baseUrl());
+ if (auto context = qmlContext(QObject::sender()))
+ warning.setUrl(context->baseUrl());
+ else
+ return;
auto signalName = QString::fromLatin1(QObject::sender()->metaObject()->method(QObject::senderSignalIndex()).name());
signalName.chop(sizeof("changed")-1);
QString propName = signalName;
propName[0] = propName[0].toLower();
warning.setDescription(QString::fromUtf8("Writing to \"%1\" broke the binding to the underlying model").arg(propName));
qmlWarning(this, warning);
- senderToConnection.erase(it);
} else {
--updateCount;
}