From 59589494ae4138a28b5b89f6f0d9f0e1cdf48234 Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Fri, 17 Jul 2015 22:45:30 +0200 Subject: [PATCH] Fix a crash when changing 'group by' while album covers are still loading --- src/globalsearch/globalsearchview.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/globalsearch/globalsearchview.cpp b/src/globalsearch/globalsearchview.cpp index 067d1e003..71c933d91 100644 --- a/src/globalsearch/globalsearchview.cpp +++ b/src/globalsearch/globalsearchview.cpp @@ -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);