Skip to content

Commit

Permalink
fix: clean up of VEH
Browse files Browse the repository at this point in the history
  • Loading branch information
NeKzor authored and mlugg committed Oct 13, 2023
1 parent ab5d038 commit b7f2c99
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/CrashHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ static void handler(int signal, siginfo_t *info, void *ucontext)
}

#ifdef _WIN32
static PVOID g_handle = nullptr;

void CrashHandler::Init() {
g_isMainThread = true;
AddVectoredExceptionHandler(1, &handler);
g_handle = AddVectoredExceptionHandler(1, &handler);

HANDLE process = GetCurrentProcess();
SymInitialize(process, 0, true);
Expand All @@ -189,7 +190,7 @@ void CrashHandler::Cleanup() {
HANDLE process = GetCurrentProcess();
SymGetModuleInfo(process, (DWORD)&Utils::GetSARPath, &info);
SymUnloadModule(process, info.BaseOfImage);
RemoveVectoredExceptionHandler(&handler);
RemoveVectoredExceptionHandler(g_handle);
SymCleanup(GetCurrentProcess());
}

Expand Down

0 comments on commit b7f2c99

Please sign in to comment.