mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-23 07:50:13 +01:00
Remove album from pixmap cache when song is removed from library model
This commit is contained in:
parent
83c4c91a2e
commit
04baa9ec0f
@ -403,7 +403,25 @@ void LibraryModel::SongsDeleted(const SongList& songs) {
|
||||
|
||||
if (node->parent != root_) parents << node->parent;
|
||||
|
||||
beginRemoveRows(ItemToIndex(node->parent), node->row, node->row);
|
||||
QModelIndex idx = ItemToIndex(node->parent);
|
||||
|
||||
// Remove from pixmap cache
|
||||
const QString cache_key = AlbumIconPixmapCacheKey(idx);
|
||||
QPixmapCache::remove(cache_key);
|
||||
icon_cache_->remove(QUrl(cache_key));
|
||||
if (pending_cache_keys_.contains(cache_key)) pending_cache_keys_.remove(cache_key);
|
||||
|
||||
// Remove from pending art loading
|
||||
QMapIterator<quint64, ItemAndCacheKey> i(pending_art_);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
if (i.value().first == node) {
|
||||
pending_art_.remove(i.key());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
beginRemoveRows(idx, node->row, node->row);
|
||||
node->parent->Delete(node->row);
|
||||
song_nodes_.remove(song.id());
|
||||
endRemoveRows();
|
||||
@ -783,6 +801,9 @@ void LibraryModel::BeginReset() {
|
||||
container_nodes_[2].clear();
|
||||
divider_nodes_.clear();
|
||||
pending_art_.clear();
|
||||
pending_cache_keys_.clear();
|
||||
QPixmapCache::clear();
|
||||
icon_cache_->clear();
|
||||
smart_playlist_node_ = nullptr;
|
||||
|
||||
root_ = new LibraryItem(this);
|
||||
|
Loading…
Reference in New Issue
Block a user