aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2025-08-21 18:30:41 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2025-09-13 11:15:07 +0000
commit1b51dade3a86efb0002cfad3c81e7d287ec9de96 (patch)
tree1e1417ba6e886820e585b4baa7eb4202bc2de752 /src
parentdd41fe2fae61e6b9d1096832fc408b65dbd011f5 (diff)
Release section item when the corresponding view item removed
The section item has not been removed or added to the section cache in all cases when the corresponding delegate item has been moved out of the visible area, either during flick or scroll. This happens in a case where the delegate item has been requested to be removed (as it goes out of the visible area) from the list view, but it's not released from the delegate model due to its caching mechanism. When an item is outside the visible area, releaseItem() is triggered, intended to free the item and its sections. The problem arises when releaseItem() calls QQmlInstanceModel::release(), which caches the item in the delegate model, but does not free the section. This prevents the section item from being released properly. This patch releases the section item whenever removeItem is triggered from the list view, which happens when the delegate item is moved out of the visible area. Fixes: QTBUG-137172 Pick-to: 6.8 6.5 Change-Id: Ib7e78309e076e76750b03f3238a7501563a3962a Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 5a664f08367095b1af9198e3678663f4e7c1094a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit d0287165a7a3d4ecb316663918ee8808c3023d4f)
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicklistview.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 69fdeafd09..6b29ac1f1d 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -806,6 +806,10 @@ void QQuickListViewPrivate::removeItem(FxViewItem *item)
#endif
{
qCDebug(lcItemViewDelegateLifecycle) << "\treleasing stationary item" << item->index << (QObject *)(item->item);
+ if (auto *att = static_cast<QQuickListViewAttached*>(item->attached)) {
+ releaseSectionItem(att->m_sectionItem);
+ att->m_sectionItem = nullptr;
+ }
releaseItem(item, reusableFlag);
}
}