Commit 68704c2a authored by Stefan Brüns's avatar Stefan Brüns
Browse files

[FileItemRolesUpdater] Fix reservation size

The code below always adds the visible range, up to 5 pages before and
after the visible range (each capped to ResolveAllItemsLimit/2) and
the very first and last page (each up to m_maximumVisibleItems).

Use this number to avoid growing the list later.
parent b4676b71
Pipeline #51199 passed with stage
in 7 minutes and 29 seconds
...@@ -1160,7 +1160,9 @@ QList<int> KFileItemModelRolesUpdater::indexesToResolve() const ...@@ -1160,7 +1160,9 @@ QList<int> KFileItemModelRolesUpdater::indexesToResolve() const
const int count = m_model->count(); const int count = m_model->count();
QList<int> result; QList<int> result;
result.reserve(ResolveAllItemsLimit); result.reserve(qMin(count, (m_lastVisibleIndex - m_firstVisibleIndex + 1) +
ResolveAllItemsLimit +
(2 * m_maximumVisibleItems)));
// Add visible items. // Add visible items.
for (int i = m_firstVisibleIndex; i <= m_lastVisibleIndex; ++i) { for (int i = m_firstVisibleIndex; i <= m_lastVisibleIndex; ++i) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment