Merge branch 'crashlog_improvements' into jgrpp

This commit is contained in:
Jonathan G Rennison
2017-02-19 12:57:55 +00:00
4 changed files with 28 additions and 0 deletions

View File

@@ -53,6 +53,20 @@ extern GameMode _game_mode;
extern SwitchMode _switch_mode;
extern bool _exit_game;
#if defined(WIN32)
extern bool _in_event_loop_post_crash;
inline bool InEventLoopPostCrash()
{
return _in_event_loop_post_crash;
}
#else
inline bool InEventLoopPostCrash()
{
return false;
}
#endif
/** Modes of pausing we've got */
enum PauseMode {
PM_UNPAUSED = 0, ///< A normal unpaused game

View File

@@ -21,6 +21,7 @@
#include "../../gamelog.h"
#include "../../saveload/saveload.h"
#include "../../video/video_driver.hpp"
#include "../../openttd.h"
#if defined(WITH_DEMANGLE)
#include <cxxabi.h>
#endif
@@ -532,6 +533,8 @@ void *_safe_esp = NULL;
static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
{
_in_event_loop_post_crash = true;
if (CrashLogWindows::current != NULL) {
CrashLog::AfterCrashLogCleanup();
ExitProcess(2);

View File

@@ -34,6 +34,8 @@
#undef strncat
#undef strncpy
bool _in_event_loop_post_crash;
static bool _has_console;
static bool _cursor_disable = true;
static bool _cursor_visible = true;
@@ -82,6 +84,7 @@ bool LoadLibraryList(Function proc[], const char *dll)
void ShowOSErrorBox(const char *buf, bool system)
{
_in_event_loop_post_crash = true;
MyShowCursor(true);
MessageBox(GetActiveWindow(), OTTD2FS(buf), _T("Error!"), MB_ICONSTOP);
}

View File

@@ -2597,6 +2597,8 @@ bool FocusWindowById(WindowClass cls, WindowNumber number)
*/
void HandleKeypress(uint keycode, WChar key)
{
if (InEventLoopPostCrash()) return;
/* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */
assert(HasModalProgress() || IsLocalCompany());
@@ -2801,6 +2803,8 @@ static void HandleKeyScrolling()
static void MouseLoop(MouseClick click, int mousewheel)
{
if (InEventLoopPostCrash()) return;
/* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */
assert(HasModalProgress() || IsLocalCompany());
@@ -2892,6 +2896,8 @@ static void MouseLoop(MouseClick click, int mousewheel)
*/
void HandleMouseEvents()
{
if (InEventLoopPostCrash()) return;
/* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */
assert(HasModalProgress() || IsLocalCompany());
@@ -2999,6 +3005,8 @@ static void CheckSoftLimit()
*/
void InputLoop()
{
if (InEventLoopPostCrash()) return;
/* World generation is multithreaded and messes with companies.
* But there is no company related window open anyway, so _current_company is not used. */
assert(HasModalProgress() || IsLocalCompany());