Fix a crash when changing 'group by' while album covers are still loading

This commit is contained in:
Arnaud Bienner 2015-07-17 22:45:30 +02:00
parent 85858d7bbe
commit 59589494ae
1 changed files with 5 additions and 0 deletions

View File

@ -560,6 +560,11 @@ void GlobalSearchView::GroupByClicked(QAction* action) {
}
void GlobalSearchView::SetGroupBy(const LibraryModel::Grouping& g) {
// Clear requests: changing "group by" on the models will cause all the items to be removed/added
// again, so all the QModelIndex here will become invalid. New requests will be created for those
// songs when they will be displayed again anyway (when GlobalSearchItemDelegate::paint will call
// LazyLoadArt)
art_requests_.clear();
// Update the models
front_model_->SetGroupBy(g, true);
back_model_->SetGroupBy(g, false);