- Addressed crash on exit with MinGW. This is a hack and i've reported it as a bug in the MinGW C runtime.

This commit is contained in:
drfrag666 2018-05-17 12:06:44 +02:00
parent f8dc707edf
commit 0e25e40deb
3 changed files with 29 additions and 0 deletions

View file

@ -77,6 +77,10 @@
extern FILE *Logfile;
extern bool insave;
#ifdef __MINGW32__
extern bool exiting; // for MinGW
#endif
CVAR (Bool, sv_cheats, false, CVAR_SERVERINFO | CVAR_LATCH)
CVAR (Bool, sv_unlimited_pickup, false, CVAR_SERVERINFO)
@ -100,11 +104,17 @@ bool CheckCheatmode (bool printmsg)
CCMD (quit)
{
#ifdef __MINGW32__
exiting = true;
#endif
if (!insave) exit (0);
}
CCMD (exit)
{
#ifdef __MINGW32__
exiting = true;
#endif
if (!insave) exit (0);
}

View file

@ -41,6 +41,10 @@
#include "vmintern.h"
#include "types.h"
#ifdef __MINGW32__
extern bool exiting; // for MinGW
#endif
cycle_t VMCycles[10];
int VMCalls[10];
@ -243,6 +247,13 @@ VMFrameStack::VMFrameStack()
VMFrameStack::~VMFrameStack()
{
#ifdef __MINGW32__
if (exiting) // hack hack
{
Blocks = NULL;
UnusedBlocks = NULL;
}
#endif
while (PopFrame() != NULL)
{ }
if (Blocks != NULL)

View file

@ -119,6 +119,10 @@
// TYPES -------------------------------------------------------------------
#ifdef __MINGW32__
bool exiting = false; // for MinGW
#endif
class FBasicStartupScreen : public FStartupScreen
{
public:
@ -1093,6 +1097,10 @@ void FStrifeStartupScreen::DrawStuff(int old_laser, int new_laser)
void ST_Endoom()
{
#ifdef __MINGW32__
exiting = true;
#endif
if (showendoom == 0) exit(0);
if (gameinfo.Endoom.Len() == 0)