From 9bfee8edff1de2177a47e8417cfdfbe88f438bf8 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 30 Oct 2020 10:34:37 +0100 Subject: [PATCH] Fixed two issues with grouped custom collections. A crash was caused by the grouped custom collection flag not being set to false when changing from grouped to ungrouped via the settings menu, and the favorite game counter was not updated for custom collections as the actual system was sorted instead of the parent system. --- es-app/src/CollectionSystemManager.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/es-app/src/CollectionSystemManager.cpp b/es-app/src/CollectionSystemManager.cpp index ad379d294..949ca9b56 100644 --- a/es-app/src/CollectionSystemManager.cpp +++ b/es-app/src/CollectionSystemManager.cpp @@ -414,8 +414,17 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS // collection, then skip the sorting. else if (sysData.decl.isCustom && children.find(file->getFullPath()) != children.cend()) { - rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()), - mFavoritesSorting); + // For custom collections, update either the actual system or its parent depending + // on whether the collection is grouped or not. + if (rootFolder->getSystem()->isGroupedCustomCollection()) { + rootFolder->getParent()->sort(rootFolder->getParent()-> + getSortTypeFromString(rootFolder->getParent()-> + getSortTypeString()), mFavoritesSorting); + } + else { + rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()), + mFavoritesSorting); + } } else if (!sysData.decl.isCustom) { rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()), @@ -1051,6 +1060,7 @@ void CollectionSystemManager::addEnabledCollectionsToDisplayedSystems( if (!gameList->getCursor()->isPlaceHolder()) { gameList->setCursor(gameList->getFirstEntry()); } + it->second.system->setIsGroupedCustomCollection(false); } } else {