From 0563a59b1b99432ff4ca899797d2898c4a1d7afc Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 21 May 2023 17:33:33 +0200 Subject: [PATCH] impr: Reset back all signals when a fatal error occurred --- main/source/window/window.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index f62218cc9..2a214d500 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -58,7 +58,10 @@ namespace hex { } // Reset the signal handler to the default handler - std::signal(signalNumber, SIG_DFL); + std::signal(SIGSEGV, SIG_DFL); + std::signal(SIGILL, SIG_DFL); + std::signal(SIGABRT, SIG_DFL); + std::signal(SIGFPE, SIG_DFL); // Print stack trace for (const auto &stackFrame : stacktrace::getStackTrace()) { @@ -193,15 +196,15 @@ namespace hex { // Register signal handlers { - #define HANDLE_SIGNAL(name) \ + #define HANDLE_SIGNAL(name) \ std::signal(name, [](int signalNumber){ \ signalHandler(signalNumber, #name); \ - }); + }) - HANDLE_SIGNAL(SIGSEGV) - HANDLE_SIGNAL(SIGILL) - HANDLE_SIGNAL(SIGABRT) - HANDLE_SIGNAL(SIGFPE) + HANDLE_SIGNAL(SIGSEGV); + HANDLE_SIGNAL(SIGILL); + HANDLE_SIGNAL(SIGABRT); + HANDLE_SIGNAL(SIGFPE); #undef HANDLE_SIGNAL }