diff options
author | rubidium <rubidium@openttd.org> | 2009-06-13 12:03:37 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-06-13 12:03:37 +0000 |
commit | 2a7b07137aaba7f84f2c45322aed52bed1d0988e (patch) | |
tree | 15346ab1e669f61352f67540181c204057f4a94d /src | |
parent | 62f120b296e3667cba20e4cf5da7ec4d4dd69d5c (diff) | |
download | openttd-2a7b07137aaba7f84f2c45322aed52bed1d0988e.tar.xz |
(svn r16572) -Codechange: also catch FPEs in saveload and the warning about missing NewGRFs; only happens when assertions are disabled and NewGRFs are missing.
Diffstat (limited to 'src')
-rw-r--r-- | src/saveload/afterload.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 2ff9b1667..91e826567 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -237,7 +237,8 @@ static bool InitializeWindowsAndCaches() typedef void (CDECL *SignalHandlerPointer)(int); static SignalHandlerPointer _prev_segfault = NULL; -static SignalHandlerPointer _prev_abort = NULL; +static SignalHandlerPointer _prev_abort = NULL; +static SignalHandlerPointer _prev_fpe = NULL; static void CDECL HandleSavegameLoadCrash(int signum); @@ -248,7 +249,8 @@ static void CDECL HandleSavegameLoadCrash(int signum); static void SetSignalHandlers() { _prev_segfault = signal(SIGSEGV, HandleSavegameLoadCrash); - _prev_abort = signal(SIGABRT, HandleSavegameLoadCrash); + _prev_abort = signal(SIGABRT, HandleSavegameLoadCrash); + _prev_fpe = signal(SIGFPE, HandleSavegameLoadCrash); } /** @@ -258,6 +260,7 @@ static void ResetSignalHandlers() { signal(SIGSEGV, _prev_segfault); signal(SIGABRT, _prev_abort); + signal(SIGFPE, _prev_fpe); } /** @@ -300,7 +303,13 @@ static void CDECL HandleSavegameLoadCrash(int signum) ShowInfo(buffer); - SignalHandlerPointer call = signum == SIGSEGV ? _prev_segfault : _prev_abort; + SignalHandlerPointer call = NULL; + switch (signum) { + case SIGSEGV: call = _prev_segfault; break; + case SIGABRT: call = _prev_abort; break; + case SIGFPE: call = _prev_fpe; break; + default: NOT_REACHED(); + } if (call != NULL) call(signum); } |