1
0
mirror of synced 2024-11-12 10:10:53 +01:00

fix: Crash backups not getting saved when when an exception is thrown

This commit is contained in:
WerWolv 2023-06-11 17:27:09 +02:00
parent f2509cda1d
commit 9a9b211ebb

View File

@ -55,14 +55,14 @@ namespace hex::crash {
static void signalHandler(int signalNumber, const std::string &signalName) {
log::fatal("Terminating with signal '{}' ({})", signalName, signalNumber);
// Trigger the crash callback
crashCallback(hex::format("Received signal '{}' ({})", signalName, signalNumber));
// Trigger an event so that plugins can handle crashes
// It may affect things (like the project path),
// so we do this after saving the crash file
EventManager::post<EventAbnormalTermination>(signalNumber);
// Trigger the crash callback
crashCallback(hex::format("Received signal '{}' ({})", signalName, signalNumber));
// Detect if the crash was due to an uncaught exception
if (std::uncaught_exceptions() > 0) {
log::fatal("Uncaught exception thrown!");
@ -113,6 +113,8 @@ namespace hex::crash {
);
log::fatal("Program terminated with uncaught exception: {}", exceptionStr);
EventManager::post<EventAbnormalTermination>(0);
// Handle crash callback
crashCallback(hex::format("Uncaught exception: {}", exceptionStr));