From 6b52336bf7788a9892d1cbb4a07246aed875def8 Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Sat, 3 May 2025 22:28:50 -0400 Subject: [PATCH] AchievementManager: Fix unknown hash achievements deadlock Within AchievementManager, CloseGame being called when LoadGame fails was causing m_queue.Cancel to be called within a lock when Cancel itself locks until it is empty, causing a deadlock. This is resolved by cancelling the queues outside of the lock when they are safe to wait for resolutions. --- Source/Core/Core/AchievementManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index f5067f5d6e..24a3a418a0 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -719,6 +719,8 @@ void AchievementManager::DoState(PointerWrap& p) void AchievementManager::CloseGame() { + m_queue.Cancel(); + m_image_queue.Cancel(); { std::lock_guard lg{m_lock}; m_active_challenges.clear(); @@ -730,8 +732,6 @@ void AchievementManager::CloseGame() m_locked_badges.clear(); m_leaderboard_map.clear(); m_rich_presence.fill('\0'); - m_queue.Cancel(); - m_image_queue.Cancel(); m_system.store(nullptr, std::memory_order_release); if (Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED)) Discord::UpdateDiscordPresence();