diff --git a/src/crashlog.cpp b/src/crashlog.cpp index e3be578da1..6382d81e4b 100644 --- a/src/crashlog.cpp +++ b/src/crashlog.cpp @@ -454,6 +454,13 @@ bool CrashLog::WriteScreenshot(char *filename, const char *filename_last) const return res; } +void CrashLog::SendSurvey() const +{ + if (_game_mode == GM_NORMAL) { + _survey.Transmit(NetworkSurveyHandler::Reason::CRASH, true); + } +} + /** * Makes the crash log, writes it to a file and then subsequently tries * to make a crash dump and crash savegame. It uses DEBUG to write @@ -512,9 +519,7 @@ bool CrashLog::MakeCrashLog() const printf("Writing crash screenshot failed.\n\n"); } - if (_game_mode == GM_NORMAL) { - _survey.Transmit(NetworkSurveyHandler::Reason::CRASH, true); - } + this->SendSurvey(); return ret; } diff --git a/src/crashlog.h b/src/crashlog.h index e90b13b499..9aad7658e9 100644 --- a/src/crashlog.h +++ b/src/crashlog.h @@ -99,6 +99,8 @@ public: bool WriteSavegame(char *filename, const char *filename_last) const; bool WriteScreenshot(char *filename, const char *filename_last) const; + void SendSurvey() const; + bool MakeCrashLog() const; /** diff --git a/src/os/macosx/crashlog_osx.cpp b/src/os/macosx/crashlog_osx.cpp index 78c550aa9e..df1736a6f6 100644 --- a/src/os/macosx/crashlog_osx.cpp +++ b/src/os/macosx/crashlog_osx.cpp @@ -192,6 +192,8 @@ public: ret = false; } + this->SendSurvey(); + return ret; } diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index c4b5e9597e..3b3c089ee3 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -564,6 +564,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep) log->AppendDecodedStacktrace(buf, lastof(log->crashlog)); log->WriteCrashLog(log->crashlog, log->crashlog_filename, lastof(log->crashlog_filename)); log->WriteScreenshot(log->screenshot_filename, lastof(log->screenshot_filename)); + log->SendSurvey(); /* Close any possible log files */ CloseConsoleLogIfActive();