Windows crash log: Use TerminateProcess instead of ExitProcess
This commit is contained in:
@@ -52,6 +52,13 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wclobbered"
|
#pragma GCC diagnostic ignored "-Wclobbered"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void NORETURN ImmediateExitProcess(uint exit_code)
|
||||||
|
{
|
||||||
|
/* TerminateProcess may fail in some special edge cases, fall back to ExitProcess in this case */
|
||||||
|
TerminateProcess(GetCurrentProcess(), exit_code);
|
||||||
|
ExitProcess(exit_code);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Windows implementation for the crash logger.
|
* Windows implementation for the crash logger.
|
||||||
*/
|
*/
|
||||||
@@ -715,7 +722,7 @@ char *CrashLogWindows::AppendDecodedStacktrace(char *buffer, const char *last) c
|
|||||||
if (exception_num != 0) {
|
if (exception_num != 0) {
|
||||||
if (this->internal_fault_saved_buffer == nullptr) {
|
if (this->internal_fault_saved_buffer == nullptr) {
|
||||||
/* if we get here, things are unrecoverable */
|
/* if we get here, things are unrecoverable */
|
||||||
ExitProcess(43);
|
ImmediateExitProcess(43);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = this->internal_fault_saved_buffer;
|
buffer = this->internal_fault_saved_buffer;
|
||||||
@@ -763,7 +770,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
|||||||
|
|
||||||
if (CrashLogWindows::current != nullptr) {
|
if (CrashLogWindows::current != nullptr) {
|
||||||
CrashLog::AfterCrashLogCleanup();
|
CrashLog::AfterCrashLogCleanup();
|
||||||
ExitProcess(2);
|
ImmediateExitProcess(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *abort_reason = CrashLog::GetAbortCrashlogReason();
|
const char *abort_reason = CrashLog::GetAbortCrashlogReason();
|
||||||
@@ -772,7 +779,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
|||||||
_snwprintf(_emergency_crash, lengthof(_emergency_crash),
|
_snwprintf(_emergency_crash, lengthof(_emergency_crash),
|
||||||
L"A serious fault condition occurred in the game. The game will shut down. (%s)\n", OTTD2FS(abort_reason).c_str());
|
L"A serious fault condition occurred in the game. The game will shut down. (%s)\n", OTTD2FS(abort_reason).c_str());
|
||||||
MessageBox(nullptr, _emergency_crash, L"Fatal Application Failure", MB_ICONERROR);
|
MessageBox(nullptr, _emergency_crash, L"Fatal Application Failure", MB_ICONERROR);
|
||||||
ExitProcess(3);
|
ImmediateExitProcess(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoDriver::EmergencyAcquireGameLock(1000, 5);
|
VideoDriver::EmergencyAcquireGameLock(1000, 5);
|
||||||
@@ -824,6 +831,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CrashLog::AfterCrashLogCleanup();
|
CrashLog::AfterCrashLogCleanup();
|
||||||
|
ImmediateExitProcess(1);
|
||||||
return EXCEPTION_EXECUTE_HANDLER;
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,7 +1015,7 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA
|
|||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
case 12: // Close
|
case 12: // Close
|
||||||
CrashLog::AfterCrashLogCleanup();
|
CrashLog::AfterCrashLogCleanup();
|
||||||
ExitProcess(2);
|
ImmediateExitProcess(2);
|
||||||
case 13: // Emergency save
|
case 13: // Emergency save
|
||||||
_savegame_DBGL_data = CrashLogWindows::current->crashlog;
|
_savegame_DBGL_data = CrashLogWindows::current->crashlog;
|
||||||
_save_DBGC_data = true;
|
_save_DBGC_data = true;
|
||||||
@@ -1033,7 +1041,7 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
CrashLog::AfterCrashLogCleanup();
|
CrashLog::AfterCrashLogCleanup();
|
||||||
ExitProcess(2);
|
ImmediateExitProcess(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Reference in New Issue
Block a user