From 83cf6e6fa391effb3b6a38d80030de9067986d12 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 28 Oct 2019 22:59:56 +0300 Subject: [PATCH] Qt: fix crash on startup in game_list_frame::Refresh QList isn't supposed to be modified concurrently. Use lf_queue to collect game_info data. --- rpcs3/rpcs3qt/game_list_frame.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 496fef30b1..8111932b09 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -10,6 +10,7 @@ #include "Emu/System.h" #include "Loader/PSF.h" #include "Utilities/types.h" +#include "Utilities/lockless.h" #include #include @@ -455,6 +456,8 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) for (size_t i = 0; i < path_list.size(); ++i) indices.append(i); + lf_queue games; + QtConcurrent::blockingMap(indices, [&](size_t& i) { const std::string dir = path_list[i]; @@ -537,7 +540,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) const QColor color = getGridCompatibilityColor(compat.color); const QPixmap pxmap = PaintedPixmap(icon, hasCustomConfig, hasCustomPadConfig, color); - m_game_data.push_back(game_info(new gui_game_info{ game, compat, icon, pxmap, hasCustomConfig, hasCustomPadConfig })); + games.push(std::make_shared(gui_game_info{game, compat, icon, pxmap, hasCustomConfig, hasCustomPadConfig})); } catch (const std::exception& e) { @@ -546,6 +549,11 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter) } }); + for (auto&& g : games.pop_all()) + { + m_game_data.push_back(std::move(g)); + } + // Try to update the app version for disc games if there is a patch for (const auto& entry : m_game_data) {