From 933a9e5596adbe33ad24090787527fd56b19aacf Mon Sep 17 00:00:00 2001 From: OpenSauce Date: Wed, 21 Jan 2026 21:15:49 +0000 Subject: [PATCH] qt: Workaround for Qt directoryChanged event spam on macOS (#1665) * qt: Workaround for Qt directoryChanged event spam on macOS * Use steady_clock instead of system_clock --- src/citra_qt/game_list.cpp | 10 +++++++++- src/citra_qt/game_list.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index d6e3efdb5..cf73dab2e 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -1113,13 +1113,21 @@ const QStringList GameList::supported_file_extensions = { }; void GameList::RefreshGameDirectory() { - // Do not scan directories when the system is powered on, it will be // repopulated on shutdown anyways. if (Core::System::GetInstance().IsPoweredOn()) { return; } + const auto time_now = std::chrono::steady_clock::now(); + + // Max of 1 refresh every 1 second. + if (time_last_refresh + std::chrono::seconds(1) > time_now) { + return; + } + + time_last_refresh = time_now; + if (!UISettings::values.game_dirs.isEmpty() && current_worker != nullptr) { LOG_INFO(Frontend, "Change detected in the applications directory. Reloading game list."); PopulateAsync(UISettings::values.game_dirs); diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h index a28cf4290..3d3cf92b5 100644 --- a/src/citra_qt/game_list.h +++ b/src/citra_qt/game_list.h @@ -151,6 +151,8 @@ private: friend class GameListSearchField; const PlayTime::PlayTimeManager& play_time_manager; + + std::chrono::time_point time_last_refresh; }; class GameListPlaceholder : public QWidget {