ref: fa32d12bfa647565cce1b2f9e25ad7d7b0a1d4fc
parent: decc0a876f8fa1c3cd8fef6307809c6617933b73
author: Simon Howard <fraggle@gmail.com>
date: Wed Jun 21 15:08:20 EDT 2006
Let the SDL parachute catch crashes and shut down properly. Don't crash after playing demos. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 562
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: g_game.c 475 2006-05-05 19:49:34Z fraggle $
+// $Id: g_game.c 562 2006-06-21 19:08:20Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -134,7 +134,7 @@
static const char
-rcsid[] = "$Id: g_game.c 475 2006-05-05 19:49:34Z fraggle $";
+rcsid[] = "$Id: g_game.c 562 2006-06-21 19:08:20Z fraggle $";
#include <string.h>
#include <stdlib.h>
@@ -1889,6 +1889,10 @@
realtics = endtime - starttime;
fps = ((float) gametic * 35) / realtics;
+ // Prevent recursive calls
+ timingdemo = false;
+ demoplayback = false;
+
I_Error ("timed %i gametics in %i realtics (%f fps)",
gametic, realtics, fps);
}
@@ -1895,9 +1899,6 @@
if (demoplayback)
{
- if (singledemo)
- I_Quit ();
-
Z_ChangeTag (demobuffer, PU_CACHE);
demoplayback = false;
netdemo = false;
@@ -1908,7 +1909,12 @@
fastparm = false;
nomonsters = false;
consoleplayer = 0;
- D_AdvanceDemo ();
+
+ if (singledemo)
+ I_Quit ();
+ else
+ D_AdvanceDemo ();
+
return true;
}
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_main.c 424 2006-03-18 21:22:09Z fraggle $
+// $Id: i_main.c 562 2006-06-21 19:08:20Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -48,7 +48,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_main.c 424 2006-03-18 21:22:09Z fraggle $";
+rcsid[] = "$Id: i_main.c 562 2006-06-21 19:08:20Z fraggle $";
#include <SDL.h>
@@ -59,11 +59,6 @@
#include "m_argv.h"
#include "d_main.h"
-void SignalHandler(int signum)
-{
- I_Error("Aborting due to signal %i\n", signum);
-}
-
int main(int argc, char **argv)
{
@@ -71,19 +66,6 @@
myargc = argc;
myargv = argv;
-
- signal(SIGSEGV, SignalHandler);
- signal(SIGTERM, SignalHandler);
- signal(SIGILL, SignalHandler);
- signal(SIGINT, SignalHandler);
- signal(SIGFPE, SignalHandler);
- signal(SIGABRT, SignalHandler);
-#ifdef SIGHUP
- signal(SIGHUP, SignalHandler);
-#endif
-#ifdef SIGPIPE
- signal(SIGHUP, SignalHandler);
-#endif
// start doom