mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
fix: Crashes in non-main threads causing freezes
This commit is contained in:
@@ -84,6 +84,9 @@ namespace hex::crash {
|
||||
triggerSafeShutdown(signalNumber);
|
||||
});
|
||||
|
||||
// Terminate this thread
|
||||
pthread_kill(pthread_self(), SIGABRT);
|
||||
|
||||
while (true) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
@@ -123,12 +126,7 @@ namespace hex::crash {
|
||||
#endif
|
||||
}
|
||||
|
||||
static std::atomic_bool s_terminationStarted;
|
||||
|
||||
void handleCrash(const std::string &msg) {
|
||||
if (s_terminationStarted.exchange(true))
|
||||
return;
|
||||
|
||||
// Call the crash callback
|
||||
crashCallback(msg);
|
||||
|
||||
@@ -146,9 +144,6 @@ 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 (s_terminationStarted.exchange(true))
|
||||
return;
|
||||
|
||||
#if !defined (DEBUG)
|
||||
if (signalNumber == SIGINT) {
|
||||
ImHexApi::System::closeImHex();
|
||||
@@ -171,9 +166,6 @@ namespace hex::crash {
|
||||
}
|
||||
|
||||
static void uncaughtExceptionHandler() {
|
||||
if (s_terminationStarted.exchange(true))
|
||||
return;
|
||||
|
||||
// Reset crash handlers, so we can't have a recursion if this code crashes
|
||||
resetCrashHandlers();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user