[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/video sdl.c
From: |
Russell Smith |
Subject: |
[Stratagus-CVS] stratagus/src/video sdl.c |
Date: |
Tue, 02 Dec 2003 01:19:43 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Russell Smith <address@hidden> 03/12/02 01:19:43
Modified files:
src/video : sdl.c
Log message:
Applied Patch #2272 Clean exit when stratagus is compiled with debug
enabled (from Allan Douglas)
Patches:
Index: stratagus/src/video/sdl.c
diff -u stratagus/src/video/sdl.c:1.108 stratagus/src/video/sdl.c:1.109
--- stratagus/src/video/sdl.c:1.108 Mon Dec 1 23:00:16 2003
+++ stratagus/src/video/sdl.c Tue Dec 2 01:19:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: sdl.c,v 1.108 2003/12/02 04:00:16 nehalmistry Exp $
+// $Id: sdl.c,v 1.109 2003/12/02 06:19:43 mr-russ Exp $
//@{
@@ -38,6 +38,10 @@
#ifdef USE_SDL // {
+#ifdef DEBUG
+#include <signal.h>
+#endif
+
#include <stdlib.h>
#include <string.h>
@@ -149,8 +153,21 @@
}
#endif
+#ifdef DEBUG
+local void CleanExit(int signum)
+{
+ // Clean SDL
+ SDL_Quit();
+ // Reestablish normal behaviour for next abort call
+ signal(SIGABRT, SIG_DFL);
+ // Generates a core dump
+ abort();
+}
+#endif
+
+
/**
-** Initialze the video part for SDL.
+** Initialize the video part for SDL.
*/
global void InitVideoSdl(void)
{
@@ -177,6 +194,12 @@
atexit(SDL_Quit);
+ // If debug is enabled, Stratagus disable SDL Parachute.
+ // So we need gracefully handle segfaults and aborts.
+#ifdef DEBUG
+ signal(SIGSEGV, CleanExit);
+ signal(SIGABRT, CleanExit);
+#endif
// Set WindowManager Title
SDL_WM_SetCaption("Stratagus", "Stratagus");