diff options
| author | Ismael Asensio <[email protected]> | 2020-11-06 21:22:14 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2020-11-08 21:59:34 +0000 |
| commit | ee4ab8ce699bd0fd10fe664e053eb6f26da94268 (patch) | |
| tree | 4b6c8f3eac895168893fa9de8136f13c296d74b7 /src/kitemviews/kfileitemmodelrolesupdater.cpp | |
| parent | e270aae9203949d25e983f53f33415fb17a0d064 (diff) | |
Iterate over a const copy list of containers
This effectively reverts the mutable iterations approach on
2448f88c5f42d7a2040fcf3bcd3c5f2a2f62cd03, and fix crashes
and ghost items when using the filter bar
BUG: 428374
Diffstat (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemmodelrolesupdater.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index 25e1a3685..f6f2815df 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -957,9 +957,9 @@ void KFileItemModelRolesUpdater::updateChangedItems() QList<int> visibleChangedIndexes; QList<int> invisibleChangedIndexes; - QMutableSetIterator<KFileItem> it(m_changedItems); - while (it.hasNext()) { - const KFileItem item = it.next(); + // Iterate over a const copy because items are deleted within the loop + const auto changedItems = m_changedItems; + for (const KFileItem item : changedItems) { const int index = m_model->index(item); if (index < 0) { |
