From 2c69f9c407ec803c3c99713fe591717ebcee191b Mon Sep 17 00:00:00 2001 From: Eran Mizrahi Date: Mon, 11 Dec 2017 20:23:42 +0200 Subject: call previous unhandled exception filter --- src/main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 7f1f199e..eed4dfd3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,20 +120,22 @@ bool bootstrap() return true; } +LPTOP_LEVEL_EXCEPTION_FILTER prevUnhandledExceptionFilter = nullptr; static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs) { const std::wstring& dumpPath = OrganizerCore::crashDumpsPath(); int dumpRes = CreateMiniDump(exceptionPtrs, OrganizerCore::getGlobalCrashDumpsType(), dumpPath.c_str()); - if (!dumpRes) { + if (!dumpRes) qCritical("ModOrganizer has crashed, crash dump created."); - return EXCEPTION_EXECUTE_HANDLER; - } - else { + else qCritical("ModOrganizer has crashed, CreateMiniDump failed (%d, error %lu).", dumpRes, GetLastError()); + + if (prevUnhandledExceptionFilter) + return prevUnhandledExceptionFilter(exceptionPtrs); + else return EXCEPTION_CONTINUE_SEARCH; - } } static bool HaveWriteAccess(const std::wstring &path) @@ -526,7 +528,7 @@ int runApplication(MOApplication &application, SingleInstance &instance, int main(int argc, char *argv[]) { - SetUnhandledExceptionFilter(MyUnhandledExceptionFilter); + prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter); MOApplication application(argc, argv); QStringList arguments = application.arguments(); -- cgit v1.3.1