diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 1de18da266..a172456a2f 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -173,10 +173,10 @@ game_list_frame::game_list_frame(std::shared_ptr gui_settings, std m_serials.clear(); m_games.pop_all(); }); - connect(this, &game_list_frame::IconReady, this, [this](movie_item* item) + connect(this, &game_list_frame::IconReady, this, [this](const game_info& game) { - if (!item) return; - item->call_icon_func(); + if (!game || !game->item) return; + game->item->call_icon_func(); }); connect(this, &game_list_frame::SizeOnDiskReady, this, [this](const game_info& game) { @@ -285,7 +285,7 @@ game_list_frame::~game_list_frame() void game_list_frame::FixNarrowColumns() const { - qApp->processEvents(); + QApplication::processEvents(); // handle columns (other than the icon column) that have zero width after showing them (stuck between others) for (int col = 1; col < m_columnActs.count(); ++col) @@ -365,10 +365,6 @@ bool game_list_frame::IsEntryVisible(const game_info& game, bool search_fallback void game_list_frame::SortGameList() { - gui::utils::stop_future_watcher(m_parsing_watcher, false); - gui::utils::stop_future_watcher(m_refresh_watcher, false); - WaitAndAbortRepaintThreads(); - // Back-up old header sizes to handle unwanted column resize in case of zero search results const int old_row_count = m_game_list->rowCount(); const int old_game_count = m_game_data.count(); @@ -2635,6 +2631,11 @@ void game_list_frame::PopulateGameList() const std::string selected_item = CurrentSelectionPath(); // Release old data + for (const auto& game : m_game_data) + { + game->item = nullptr; + } + m_game_grid->clear_list(); m_game_list->clear_list(); @@ -2658,7 +2659,6 @@ void game_list_frame::PopulateGameList() if (!IsEntryVisible(game, use_search_fallback)) { - game->item = nullptr; continue; } @@ -3171,7 +3171,7 @@ void game_list_frame::IconLoadFunction(game_info game, std::shared_ptrload()) { - Q_EMIT IconReady(game->item); + Q_EMIT IconReady(game); } } diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index c3e7827139..0a166fc608 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -96,7 +96,7 @@ Q_SIGNALS: void RequestBoot(const game_info& game, cfg_mode config_mode = cfg_mode::custom, const std::string& config_path = "", const std::string& savestate = ""); void RequestIconSizeChange(const int& val); void NotifyEmuSettingsChange(); - void IconReady(movie_item* item); + void IconReady(const game_info& game); void SizeOnDiskReady(const game_info& game); void FocusToSearchBar(); protected: diff --git a/rpcs3/rpcs3qt/movie_item.cpp b/rpcs3/rpcs3qt/movie_item.cpp index f6fb1d6f4c..7c65b3781e 100644 --- a/rpcs3/rpcs3qt/movie_item.cpp +++ b/rpcs3/rpcs3qt/movie_item.cpp @@ -73,13 +73,13 @@ void movie_item::set_icon_func(const icon_callback_t& func) void movie_item::call_icon_load_func(int index) { - wait_for_icon_loading(true); - - if (!m_icon_load_callback || m_icon_loading) + if (!m_icon_load_callback || m_icon_loading || m_icon_loading_aborted->load()) { return; } + wait_for_icon_loading(true); + *m_icon_loading_aborted = false; m_icon_loading = true; m_icon_load_thread.reset(QThread::create([this, index]() @@ -98,17 +98,18 @@ void movie_item::set_icon_load_func(const icon_load_callback_t& func) m_icon_loading = false; m_icon_load_callback = func; + *m_icon_loading_aborted = false; } void movie_item::call_size_calc_func() { - wait_for_size_on_disk_loading(true); - - if (!m_size_calc_callback || m_size_on_disk_loading) + if (!m_size_calc_callback || m_size_on_disk_loading || m_size_on_disk_loading_aborted->load()) { return; } + wait_for_size_on_disk_loading(true); + *m_size_on_disk_loading_aborted = false; m_size_on_disk_loading = true; m_size_calc_thread.reset(QThread::create([this]() @@ -125,13 +126,15 @@ void movie_item::set_size_calc_func(const size_calc_callback_t& func) { m_size_on_disk_loading = false; m_size_calc_callback = func; + *m_size_on_disk_loading_aborted = false; } void movie_item::wait_for_icon_loading(bool abort) { + *m_icon_loading_aborted = abort; + if (m_icon_load_thread && m_icon_load_thread->isRunning()) { - *m_icon_loading_aborted = abort; m_icon_load_thread->wait(); m_icon_load_thread.reset(); } @@ -139,9 +142,10 @@ void movie_item::wait_for_icon_loading(bool abort) void movie_item::wait_for_size_on_disk_loading(bool abort) { + *m_size_on_disk_loading_aborted = abort; + if (m_size_calc_thread && m_size_calc_thread->isRunning()) { - *m_size_on_disk_loading_aborted = abort; m_size_calc_thread->wait(); m_size_calc_thread.reset(); }