From a5ac24adc57e44d85547b73b5abc01860f9de740 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 f74bc297b..2bccd86a3 100644 --- a/src/citra_qt/game_list.h +++ b/src/citra_qt/game_list.h @@ -153,6 +153,8 @@ private: friend class GameListSearchField; const PlayTime::PlayTimeManager& play_time_manager; + + std::chrono::time_point time_last_refresh; }; class GameListPlaceholder : public QWidget {