Remove titles from the GuiIconGrid which were removed from the GameList

This commit is contained in:
Maschell 2020-02-20 15:20:20 +01:00
parent 7ef3e4dc2e
commit b4cdf11f6a

View File

@ -75,6 +75,28 @@ uint64_t GuiIconGrid::getSelectedGame(void) {
void GuiIconGrid::OnGameTitleListUpdated(GameList * gameList) { void GuiIconGrid::OnGameTitleListUpdated(GameList * gameList) {
containerMutex.lock(); containerMutex.lock();
gameList->lock(); gameList->lock();
// At first delete the ones that were deleted;
auto it = gameInfoContainers.begin();
while (it != gameInfoContainers.end()) {
bool wasFound = false;
for(int32_t i = 0; i < gameList->size(); i++) {
gameInfo * info = gameList->at(i);
if(info != NULL && info->titleId == it->first) {
wasFound = true;
break;
}
}
if (!wasFound) {
DEBUG_FUNCTION_LINE("Removing %016llX\n", it->first);
remove(it->second->button);
delete it->second;
it = gameInfoContainers.erase(it);
} else {
++it;
}
}
for(int32_t i = 0; i < gameList->size(); i++) { for(int32_t i = 0; i < gameList->size(); i++) {
gameInfo * info = gameList->at(i); gameInfo * info = gameList->at(i);
GameInfoContainer * container = NULL; GameInfoContainer * container = NULL;