From 1c09222dd7475b8e39cb7722f6f2393b0954b59b Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 3 Apr 2026 18:37:14 +1100 Subject: [PATCH] fix: only destroy delegates when visually out of viewport --- plugin/src/Caelestia/Components/lazylistview.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugin/src/Caelestia/Components/lazylistview.cpp b/plugin/src/Caelestia/Components/lazylistview.cpp index 07c4d31e..50340ca7 100644 --- a/plugin/src/Caelestia/Components/lazylistview.cpp +++ b/plugin/src/Caelestia/Components/lazylistview.cpp @@ -549,10 +549,19 @@ void LazyListView::syncDelegates() { visibleIndices.insert(i); } - // Collect delegates to destroy (outside visible range and not animating) + // Collect delegates to destroy — only if visually outside the viewport + const auto vp = effectiveViewport(); QList toRemove; for (auto it = m_delegates.begin(); it != m_delegates.end(); ++it) { - if (!visibleIndices.contains(it.key()) && !it->animation) + if (visibleIndices.contains(it.key()) || it->animation) + continue; + if (!it->item) { + toRemove.append(it.key()); + continue; + } + const qreal itemTop = it->item->y(); + const qreal itemBottom = itemTop + delegateVisibleHeight(it->item); + if (itemBottom < vp.top() || itemTop > vp.bottom()) toRemove.append(it.key()); }