From 6a2735d24ed54158b93eac217e803dcd89f67a9e Mon Sep 17 00:00:00 2001 From: michi_cc Date: Fri, 4 Nov 2011 23:47:00 +0000 Subject: (svn r23119) -Fix: [Win32] Don't show a crash/assertion message box for a GUI-less video driver. --- src/os/windows/crashlog_win.cpp | 3 ++- src/video/dedicated_v.cpp | 5 +++++ src/video/null_v.cpp | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index a02ca3c2d..2230203bf 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -25,6 +25,7 @@ #include "../../strings_func.h" #include "../../gamelog.h" #include "../../saveload/saveload.h" +#include "../../video/video_driver.hpp" #include #include @@ -526,7 +527,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep) /* Close any possible log files */ CloseConsoleLogIfActive(); - if (_safe_esp != NULL) { + if ((_video_driver == NULL || _video_driver->HasGUI()) && _safe_esp != NULL) { #ifdef _M_AMD64 ep->ContextRecord->Rip = (DWORD64)ShowCrashlogWindow; ep->ContextRecord->Rsp = (DWORD64)_safe_esp; diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index d5f63d818..8a3be5bd6 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -163,6 +163,11 @@ const char *VideoDriver_Dedicated::Start(const char * const *parm) SetConsoleTitle(_T("OpenTTD Dedicated Server")); #endif +#ifdef _MSC_VER + /* Disable the MSVC assertion message box. */ + _set_error_mode(_OUT_TO_STDERR); +#endif + #ifdef __OS2__ /* For OS/2 we also need to switch to console mode instead of PM mode */ OS2_SwitchToConsoleMode(); diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 6b4aa1c66..6fdb87648 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -19,6 +19,11 @@ static FVideoDriver_Null iFVideoDriver_Null; const char *VideoDriver_Null::Start(const char * const *parm) { +#ifdef _MSC_VER + /* Disable the MSVC assertion message box. */ + _set_error_mode(_OUT_TO_STDERR); +#endif + this->ticks = GetDriverParamInt(parm, "ticks", 1000); _screen.width = _screen.pitch = _cur_resolution.width; _screen.height = _cur_resolution.height; -- cgit v1.2.3-54-g00ecf