diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp index dbf41afb..b4faf570 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,26 +120,22 @@ bool bootstrap() return true;
}
+LPTOP_LEVEL_EXCEPTION_FILTER prevUnhandledExceptionFilter = nullptr;
static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
{
- if ((exceptionPtrs->ExceptionRecord->ExceptionCode < 0x80000000) // non-critical
- || (exceptionPtrs->ExceptionRecord->ExceptionCode == 0xe06d7363)) { // cpp exception
- // don't report non-critical exceptions
- return EXCEPTION_CONTINUE_SEARCH;
- }
-
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)
@@ -532,8 +528,6 @@ int runApplication(MOApplication &application, SingleInstance &instance, int main(int argc, char *argv[])
{
- AddVectoredExceptionHandler(0, MyUnhandledExceptionFilter);
-
MOApplication application(argc, argv);
QStringList arguments = application.arguments();
@@ -590,6 +584,9 @@ int main(int argc, char *argv[]) }
application.setProperty("dataPath", dataPath);
+ // initialize dump collection only after "dataPath" since the crashes are stored under it
+ prevUnhandledExceptionFilter = SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
+
LogBuffer::init(100, QtDebugMsg, qApp->property("dataPath").toString() + "/logs/mo_interface.log");
QString splash = dataPath + "/splash.png";
|
