1
0
mirror of synced 2024-11-28 01:20:51 +01:00

feat: Handle SIGINT

This commit is contained in:
WerWolv 2024-06-08 00:57:56 +02:00
parent 041bf47ff4
commit e954d49c29

View File

@ -120,6 +120,11 @@ namespace hex::crash {
// Custom signal handler to print various information and a stacktrace when the application crashes
static void signalHandler(int signalNumber, const std::string &signalName) {
if (signalNumber == SIGINT) {
ImHexApi::System::closeImHex();
return;
}
// Reset crash handlers, so we can't have a recursion if this code crashes
resetCrashHandlers();
@ -166,6 +171,7 @@ namespace hex::crash {
HANDLE_SIGNAL(SIGILL);
HANDLE_SIGNAL(SIGABRT);
HANDLE_SIGNAL(SIGFPE);
HANDLE_SIGNAL(SIGINT);
#if defined (SIGBUS)
HANDLE_SIGNAL(SIGBUS);