fix: Infinite loop on crash
This commit is contained in:
parent
1ea8269dec
commit
bf6b2db0cb
@ -85,11 +85,15 @@ namespace hex::crash {
|
||||
// Trigger a breakpoint if we're in a debug build or raise the signal again for the default handler to handle it
|
||||
#if defined(DEBUG)
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
__debugbreak();
|
||||
#else
|
||||
raise(SIGTRAP);
|
||||
#endif
|
||||
static bool breakpointTriggered = false;
|
||||
if (!breakpointTriggered) {
|
||||
breakpointTriggered = true;
|
||||
#if defined(OS_WINDOWS)
|
||||
__debugbreak();
|
||||
#else
|
||||
raise(SIGTRAP);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::exit(signalNumber);
|
||||
|
||||
|
@ -316,20 +316,6 @@ namespace hex {
|
||||
g_oldWndProc = ::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)commonWindowProc);
|
||||
}
|
||||
|
||||
// Add a custom exception handler to detect heap corruptions
|
||||
{
|
||||
::AddVectoredExceptionHandler(TRUE, [](PEXCEPTION_POINTERS exception) -> LONG {
|
||||
if ((exception->ExceptionRecord->ExceptionCode & 0xF000'0000) == 0xC000'0000) {
|
||||
log::fatal("Exception raised: 0x{:08X}", exception->ExceptionRecord->ExceptionCode);
|
||||
if (exception->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION) {
|
||||
log::fatal("Heap corruption detected!");
|
||||
}
|
||||
}
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
});
|
||||
}
|
||||
|
||||
// Set up a taskbar progress handler
|
||||
{
|
||||
if (SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED))) {
|
||||
|
Loading…
Reference in New Issue
Block a user