diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2017-12-12 15:43:21 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-12 15:43:21 -0600 |
| commit | 2226a483d1415a315d7b558b0e2dc9919dfa858b (patch) | |
| tree | 8b4a258adbc1df8b0bbaa9b2e4d2b617cd8f1cfb /src/main.cpp | |
| parent | 361e59e40d7e955eaaaa1cf4dd4f407a5ca7cdef (diff) | |
| parent | 240900de39aaf1562332ed88708b4b128703ad0e (diff) | |
Merge pull request #144 from erasmux/crash_fixes
Crash dumps fixes
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";
|
