From c2c7933393e57332ae1bb3f3c8faf75c7d4f9708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 20 Sep 2023 14:37:01 +0200 Subject: [PATCH] Backend change from Win32 menu: Add quick workaround for instance counter misbehavior. Should really do this some better way. See #18148 --- Windows/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Windows/main.cpp b/Windows/main.cpp index 0e3937fcd8..5149ebcc53 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -822,6 +822,13 @@ static void WinMainCleanup() { CoUninitialize(); if (g_Config.bRestartRequired) { + // TODO: ExitAndRestart prevents the Config::~Config destructor from running, + // which normally would have done this instance counter update. + // ExitAndRestart calls ExitProcess which really bad, we should do something better that + // allows us to fall out of main() properly. + if (g_Config.bUpdatedInstanceCounter) { + ShutdownInstanceCounter(); + } W32Util::ExitAndRestart(!restartArgs.empty(), restartArgs); } }