diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qmlmodels/qqmldelegatemodel.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index 4f211aea53..303ca0e2e4 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -1872,6 +1872,9 @@ void QQmlDelegateModel::_q_modelReset() d->m_count = d->adaptorModelCount(); const QList<QQmlDelegateModelItem *> cache = d->m_cache; + for (QQmlDelegateModelItem *item : cache) + item->referenceObject(); + for (int i = 0, c = cache.count(); i < c; ++i) { QQmlDelegateModelItem *item = cache.at(i); // layout change triggered by changing the modelIndex might have @@ -1883,6 +1886,8 @@ void QQmlDelegateModel::_q_modelReset() item->setModelIndex(-1, -1, -1); } + for (QQmlDelegateModelItem *item : cache) + item->releaseObject(); QVector<Compositor::Remove> removes; QVector<Compositor::Insert> inserts; if (oldCount) |