From 3185c4ce6cacaef806aa8c583ab3d7f9269ca15a Mon Sep 17 00:00:00 2001 From: Maximilian Goldstein Date: Tue, 23 Feb 2021 16:10:44 +0100 Subject: qqmldelegatemodel: Fix out of bounds cache removal Task-number: QTBUG-91276 Change-Id: I1ddbb4a3326d61ff94e3881beb64a14dade11c46 Reviewed-by: Ulf Hermann (cherry picked from commit 31ad81d81e623a34cd71567b9507f16601f1c1d4) Reviewed-by: Qt Cherry-pick Bot --- src/qmlmodels/qqmldelegatemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qmlmodels/qqmldelegatemodel.cpp b/src/qmlmodels/qqmldelegatemodel.cpp index 838a0e18e2..4cba2d3f35 100644 --- a/src/qmlmodels/qqmldelegatemodel.cpp +++ b/src/qmlmodels/qqmldelegatemodel.cpp @@ -1608,7 +1608,7 @@ void QQmlDelegateModelPrivate::itemsRemoved( removed[i] = 0; for (const Compositor::Remove &remove : removes) { - for (; cacheIndex < remove.cacheIndex; ++cacheIndex) + for (; cacheIndex < remove.cacheIndex && cacheIndex < m_cache.size(); ++cacheIndex) incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed); for (int i = 1; i < m_groupCount; ++i) { -- cgit v1.2.3