diff --git a/rpcs3/Emu/system_progress.cpp b/rpcs3/Emu/system_progress.cpp index feeaea352d..66d59af65b 100644 --- a/rpcs3/Emu/system_progress.cpp +++ b/rpcs3/Emu/system_progress.cpp @@ -41,6 +41,7 @@ void progress_dialog_server::operator()() { std::shared_ptr native_dlg; g_system_progress_stopping = false; + g_system_progress_canceled = false; const auto get_state = []() { diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index aa004211b9..a5fc1f4525 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -2277,11 +2277,13 @@ void game_list_frame::RemoveHDD1Cache(const std::string& base_dir, const std::st game_list_log.fatal("Only %d/%d HDD1 cache directories could be removed in %s (%s)", dirs_removed, dirs_total, base_dir, title_id); } -void game_list_frame::BatchActionBySerials(progress_dialog* pdlg, const std::set& serials, QString progressLabel, std::function action, std::function cancel_log, bool refresh_on_finish, bool can_be_concurrent, std::function should_wait_cb) +void game_list_frame::BatchActionBySerials(progress_dialog* pdlg, const std::set& serials, QString progressLabel, std::function action, std::function cancel_log, bool refresh_on_finish, bool can_be_concurrent, std::function should_wait_cb) { // Concurrent tasks should not wait (at least not in current implementation) ensure(!should_wait_cb || !can_be_concurrent); + g_system_progress_canceled = false; + const std::shared_ptr> iterate_over_serial = std::make_shared>(); const std::shared_ptr> index = std::make_shared>(0); @@ -2297,12 +2299,16 @@ void game_list_frame::BatchActionBySerials(progress_dialog* pdlg, const std::set const std::string& serial = *std::next(serials.begin(), index); - if (pdlg->wasCanceled() || g_system_progress_canceled) + if (pdlg->wasCanceled() || g_system_progress_canceled.exchange(false)) { - cancel_log(index, serials_size); + if (cancel_log) + { + cancel_log(index, serials_size); + } return false; } - else if (action(serial)) + + if (action(serial)) { const int done = index_ptr->load(); pdlg->setLabelText(progressLabel.arg(done + 1).arg(serials_size));