bool CrashHandler::checkForResetSettings(bool wasLikelyCrash, bool suppressPrompt) { QSettings::setDefaultFormat(JSON_FORMAT); QSettings settings; settings.beginGroup("Developer"); QVariant displayCrashOptions = settings.value(MenuOption::DisplayCrashOptions); settings.endGroup(); settings.beginGroup("Settings"); QVariant askToResetSettingsOption = settings.value(MenuOption::AskToResetSettings); settings.endGroup(); bool askToResetSettings = askToResetSettingsOption.isValid() && askToResetSettingsOption.toBool(); // If option does not exist in Interface.ini so assume default behavior. bool displaySettingsResetOnCrash = !displayCrashOptions.isValid() || displayCrashOptions.toBool(); if (suppressPrompt) { return wasLikelyCrash; } if (wasLikelyCrash || askToResetSettings) { if (displaySettingsResetOnCrash || askToResetSettings) { Action action = promptUserForAction(wasLikelyCrash); if (action != DO_NOTHING) { handleCrash(action); } } } return wasLikelyCrash; }
LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS* eInfo) { CrashData cData; cData.exceptionInfo = eInfo->ExceptionRecord; cData.context = eInfo->ContextRecord; handleCrash(cData); return EXCEPTION_EXECUTE_HANDLER; }
void handler(int sig) { CrashData cData; cData.signal = sig; handleCrash(cData); }