aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-06-15 15:51:01 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-15 18:04:45 +0000
commit9d6cc0f7ecafde186ec729f44dd412be3c845638 (patch)
tree2cec5b4aa6cf936717fa03c85244057153bb8504 /src/quick/items
parenta54621c231317c5777dea402215c30764ae96a2e (diff)
Cull removed items from QQuickItemView
Amends a20132c326f6d2c5fec848efb98dd86afb320e2a, which fixed a crash, but also prevented the item from being culled. This is fixed by narrowing the scope of the condition to affect only the caching related part. Fixes: QTBUG-84604 Change-Id: I9b8a1a148d6538a18280475d89b87a4049ff3465 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit ab03621516630991c7cc0fea3be79879efed23a8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickitemview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 7fb392233e..2b4ca9e256 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -2452,14 +2452,15 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item, QQmlInstanceModel::Reu
QQmlInstanceModel::ReleaseFlags flags = {};
if (model && item->item) {
flags = model->release(item->item, reusableFlag);
- if (!flags && !isClearing) {
+ if (!flags) {
// item was not destroyed, and we no longer reference it.
if (item->item->parentItem() == contentItem) {
// Only cull the item if its parent item is still our contentItem.
// One case where this can happen is moving an item out of one ObjectModel and into another.
QQuickItemPrivate::get(item->item)->setCulled(true);
}
- unrequestedItems.insert(item->item, model->indexOf(item->item, q));
+ if (!isClearing)
+ unrequestedItems.insert(item->item, model->indexOf(item->item, q));
} else if (flags & QQmlInstanceModel::Destroyed) {
item->item->setParentItem(nullptr);
} else if (flags & QQmlInstanceModel::Pooled) {