From 349cdd51361116518273ea5c9de06b5679205446 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 16 Jun 2020 10:29:52 +0200 Subject: [PATCH] DolphinQt: Fix crash on right-clicking multiple games GetSelectedGames() constructs a new list each time you call it. --- Source/Core/DolphinQt/GameList/GameList.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/GameList/GameList.cpp b/Source/Core/DolphinQt/GameList/GameList.cpp index b226cfada2..d3f72e14f2 100644 --- a/Source/Core/DolphinQt/GameList/GameList.cpp +++ b/Source/Core/DolphinQt/GameList/GameList.cpp @@ -256,7 +256,9 @@ void GameList::ShowContextMenu(const QPoint&) if (HasMultipleSelected()) { - if (std::all_of(GetSelectedGames().begin(), GetSelectedGames().end(), [](const auto& game) { + const auto selected_games = GetSelectedGames(); + + if (std::all_of(selected_games.begin(), selected_games.end(), [](const auto& game) { // Converting from TGC is temporarily disabled because PR #8738 was merged prematurely. // The TGC check will be removed by PR #8644. return DiscIO::IsDisc(game->GetPlatform()) && game->IsVolumeSizeAccurate() && @@ -267,7 +269,7 @@ void GameList::ShowContextMenu(const QPoint&) menu->addSeparator(); } - if (std::all_of(GetSelectedGames().begin(), GetSelectedGames().end(), + if (std::all_of(selected_games.begin(), selected_games.end(), [](const auto& game) { return DiscIO::IsWii(game->GetPlatform()); })) { menu->addAction(tr("Export Wii Saves"), this, &GameList::ExportWiiSave);