Replace while with for loop

This commit is contained in:
Jonas Kvinge 2021-06-28 00:17:53 +02:00
parent 062c59b321
commit 20a15ecd35
2 changed files with 6 additions and 9 deletions

View File

@ -568,13 +568,12 @@ void CollectionModel::SongsDeleted(const SongList &songs) {
}
// Remove from pending art loading
QMap<quint64, ItemAndCacheKey>::iterator i = pending_art_.begin();
while (i != pending_art_.end()) {
if (i.value().first == node) {
i = pending_art_.erase(i); // clazy:exclude=strict-iterators
for (QMap<quint64, ItemAndCacheKey>::iterator it = pending_art_.begin() ; it != pending_art_.end();) {
if (it.value().first == node) {
it = pending_art_.erase(it); // clazy:exclude=strict-iterators
}
else {
++i;
++it;
}
}

View File

@ -314,11 +314,9 @@ void ContextAlbumsModel::LazyPopulate(CollectionItem *parent, const bool signal)
void ContextAlbumsModel::Reset() {
QMap<QString, CollectionItem*>::iterator i = container_nodes_.begin();
while (i != container_nodes_.end()) {
const QString cache_key = AlbumIconPixmapCacheKey(ItemToIndex(i.value()));
for (QMap<QString, CollectionItem*>::const_iterator it = container_nodes_.begin() ; it != container_nodes_.end(); ++it) {
const QString cache_key = AlbumIconPixmapCacheKey(ItemToIndex(it.value()));
QPixmapCache::remove(cache_key);
++i;
}
beginResetModel();