RecentFiles: Make the loaded list visible right away

Load() only queued the list for the worker thread, so reading it right
after loading the config could still see an empty list. Android's grant
pruning does exactly that, and would then treat recent games as
unreferenced, release their grants, and the queued clean would drop them
from the list as missing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-23 13:54:31 +02:00
1 parent d7bac55348
commit 020e39baa9
1 file changed
+6
+6
View File
@@ -101,6 +101,12 @@ void RecentFilesManager::Load(const Section *recent, int maxRecent) {
// Just zapping any pending command, since they won't matter after this.
// TODO: Maybe we should let adds through...
WipePendingCommandsUnderLock();
// Visible right away, for callers that read the list straight after loading the config (Android's
// URI grant pruning). The queued ReplaceAll still runs, in case a command was mid-flight.
{
std::lock_guard<std::mutex> recentGuard(recentLock_);
recentFiles_ = newRecent;
}
cmds_.push(RecentCommand{ RecentCmd::ReplaceAll, std::make_unique<std::vector<std::string>>(newRecent) });
cmdCondVar_.notify_one();
}