aboutsummaryrefslogtreecommitdiff
path: root/src/qt_common/game_list/model.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt_common/game_list/model.cpp')
-rw-r--r--src/qt_common/game_list/model.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qt_common/game_list/model.cpp b/src/qt_common/game_list/model.cpp
index 2f8deaa0c5..91ec80c525 100644
--- a/src/qt_common/game_list/model.cpp
+++ b/src/qt_common/game_list/model.cpp
@@ -57,6 +57,12 @@ void GameListModel::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
QThreadPool::globalInstance()->start(current_worker.get());
}
+void GameListModel::StopWorker() {
+ // ~GameListWorker sets stop_requested and blocks until run() finishes, so this returns only
+ // once the worker is no longer touching the content providers.
+ current_worker.reset();
+}
+
void GameListModel::WorkerEvent() {
current_worker->ProcessEvents(this);
}
@@ -202,6 +208,7 @@ void GameListModel::RefreshGameDirectory() {
if (!UISettings::values.game_dirs.empty() && current_worker != nullptr) {
LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
+ StopWorker();
QtCommon::system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
PopulateAsync(UISettings::values.game_dirs);
}
@@ -210,6 +217,7 @@ void GameListModel::RefreshGameDirectory() {
void GameListModel::RefreshExternalContent() {
if (!UISettings::values.game_dirs.empty() && current_worker != nullptr) {
LOG_INFO(Frontend, "External content directory changed. Clearing metadata cache.");
+ StopWorker();
QtCommon::Game::ResetMetadata(false);
QtCommon::system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
PopulateAsync(UISettings::values.game_dirs);