From 445a337d32c68b43e18d637410f2fee17cc80ca8 Mon Sep 17 00:00:00 2001 From: Matthijs Lavrijsen Date: Tue, 26 Jan 2021 15:00:33 +0100 Subject: [PATCH] Do not flush spdlog on shutdown in the error reporter process --- src/dllmain.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/dllmain.cpp b/src/dllmain.cpp index e1248003..3885e65e 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -87,8 +87,12 @@ static void Initialize() static void Shutdown() { + bool inGameProcess = false; + if (s_modInstanceMutex) { + inGameProcess = CET::Get().GetOptions().ExeValid; + MH_DisableHook(MH_ALL_HOOKS); MH_Uninitialize(); @@ -97,9 +101,12 @@ static void Shutdown() ReleaseMutex(s_modInstanceMutex); } - // flush main log (== default logger) - spdlog::default_logger()->flush(); - spdlog::get("scripting")->flush(); + if (inGameProcess) + { + // flush main log (== default logger) + spdlog::default_logger()->flush(); + spdlog::get("scripting")->flush(); + } } BOOL APIENTRY DllMain(HMODULE mod, DWORD ul_reason_for_call, LPVOID)