Don't crash at exit with a download still in flight

A request started since the last RequestManager::Update (headless never
calls it) sat in newDownloads_, which CancelAll skipped. It was then
destroyed along with the static g_DownloadManager at exit, and its
destructor removed its progress bar from the already destroyed g_OSD:
"mutex lock failed". Seen with a Netconf dialog still downloading the
infra DNS json when a test ended.

CancelAll now takes the new ones too, and runs at shutdown while g_OSD is
still there. The Netconf json request is also let go of when the emulator
shuts down, rather than living on into the next game.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-24 11:23:59 -06:00
1 parent 428c1a6aa6
commit f20dd7565b
4 files changed
+18

No files matched your search

+4
View File
@@ -50,6 +50,7 @@
#include "Common/Thread/ThreadManager.h"
#include "Common/GPU/Vulkan/VulkanGraphicsContext.h"
#include "Core/CmdLine.h"
#include "Common/Net/HTTPRequest.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/Core.h"
@@ -1185,6 +1186,9 @@ int main(int argc, const char* argv[]) {
}
#endif
// A request finishing while globals are destroyed at exit touches g_OSD, which may be gone by then.
g_DownloadManager.CancelAll();
g_VFS.Clear();
g_logManager.Shutdown();
if (cmdLineOptions.DebuggerPort().has_value()) {