Skip to content

Commit

Permalink
Merge pull request #442 from Mattiwatti/fix-redengineerrorreporter-crash
Browse files Browse the repository at this point in the history
Do not flush spdlog on shutdown in the error reporter process
  • Loading branch information
Yamashi authored Jan 26, 2021
2 parents b035c38 + 445a337 commit da1c706
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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)
Expand Down

0 comments on commit da1c706

Please sign in to comment.