From 89a2d04f9621566a65ef36341d4c492390e8b6d8 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 25 Oct 2019 10:26:07 +0200 Subject: [PATCH] Qt: add mutex to game list creation should prevent random crashes when accessing maps --- rpcs3/rpcs3qt/game_list_frame.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 37b9e45476..496fef30b1 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -449,6 +449,8 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) QSet serials; + QMutex mutex_cat; + QList indices; for (size_t i = 0; i < path_list.size(); ++i) indices.append(i); @@ -482,9 +484,12 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) game.bootable = psf::get_integer(psf, "BOOTABLE", 0); game.attr = psf::get_integer(psf, "ATTRIBUTE", 0); + mutex_cat.lock(); + // Detect duplication if (!serial_cat_name[game.serial].emplace(game.category + game.name).second) { + mutex_cat.unlock(); return; } @@ -514,6 +519,8 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) game.category = sstr(category::other); } + mutex_cat.unlock(); + // Load ICON0.PNG QPixmap icon;