Merge pull request #22344 from hrydgard/download-cancel-at-exit

Don't crash at exit with a download still in flight
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2026-09-24 12:10:21 -06:00
commit 87ad32d578
4 files changed
+18

No files matched your search

+5
View File
@@ -168,6 +168,11 @@ restart:
}
void RequestManager::CancelAll() {
// Including ones started since the last Update (headless never calls it).
for (auto &iter : newDownloads_) {
downloads_.push_back(iter);
}
newDownloads_.clear();
for (size_t i = 0; i < downloads_.size(); i++) {
downloads_[i]->Cancel();
}
+6
View File
@@ -660,6 +660,12 @@ void __NetApctlShutdown() {
}
void __NetShutdown() {
// A Netconf dialog may have started the json download. Don't leave it running past us.
if (g_infraDL) {
g_infraDL->Cancel();
g_infraDL.reset();
}
// Network Cleanup
Net_Term();
+3
View File
@@ -1862,6 +1862,9 @@ void NativeShutdown() {
__UPnPShutdown();
// A request finishing while globals are destroyed at exit touches g_OSD, which may be gone by then.
g_DownloadManager.CancelAll();
net::Shutdown();
g_Discord.Shutdown();
+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()) {