netpanzer-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Core/main.cpp


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Core/main.cpp
Date: Sun, 12 Oct 2003 16:47:01 -0400

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/10/12 16:47:01

Modified files:
        .              : ChangeLog 
        src/NetPanzer/Core: main.cpp 

Log message:
        added signal handler to abort more cleanly in case of error

Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.9 netpanzer/ChangeLog:1.10
--- netpanzer/ChangeLog:1.9     Sun Oct 12 15:22:12 2003
+++ netpanzer/ChangeLog Sun Oct 12 16:47:01 2003
@@ -1,6 +1,10 @@
 12-Oct-2003
 -Fixed a bug in iXY classes.
 -Added note about black screen to readme
+-fixed bug where MiniMapView was drawing outside it's view space, leading to
+ crashes.
+-add signal handlers to make it abort more nicely in error case (don't stay in
+ mouse/keyboard grab mode)
 
 11-Oct-2003 by Matthias Braun
 -added a release script
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.12 
netpanzer/src/NetPanzer/Core/main.cpp:1.13
--- netpanzer/src/NetPanzer/Core/main.cpp:1.12  Thu Sep 25 12:59:51 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp       Sun Oct 12 16:47:01 2003
@@ -16,10 +16,12 @@
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 #include <config.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
 #include <ctype.h>
+#include <signal.h>
 #include <SDL.h>
 
 #include <optionmm/command_line.hpp>
@@ -108,8 +110,42 @@
     FileSystem::shutdown();
 }
 
+void signalhandler(int signum)
+{
+    const char* sigtype;
+    switch(signum) {
+        case SIGINT: sigtype = "SIGINT"; break;
+        case SIGHUP: sigtype = "SIGHUP"; break;
+        case SIGTERM: sigtype = "SIGTERM"; break;
+        case SIGFPE: sigtype = "SIGFPE"; break;
+        case SIGILL: sigtype = "SIGILL"; break;
+        case SIGSEGV: sigtype = "SIGSEGV"; break;
+        case SIGBUS: sigtype = "SIGBUS"; break;
+        case SIGABRT: sigtype = "SIGABRT"; break;
+        case SIGTRAP: sigtype = "SIGTRAP"; break;
+        case SIGSYS: sigtype = "SIGSYS"; break;
+        default: sigtype = "UNKNOWN"; break;
+    }
+        
+    std::cerr << "Received signal " << sigtype << "(" << signum << ")" <<
+        "aborting and trying to shutdown." << std::endl;
+    shutdown();
+}
+
 void initialise(int argc, char** argv)
 {
+    // Install signal handler
+    signal(SIGILL, signalhandler);
+    signal(SIGINT, signalhandler);
+    signal(SIGHUP, signalhandler);
+    signal(SIGTERM, signalhandler);
+    signal(SIGFPE, signalhandler);
+    signal(SIGSEGV, signalhandler);
+    signal(SIGBUS, signalhandler);
+    signal(SIGABRT, signalhandler);
+    signal(SIGTRAP, signalhandler);
+    signal(SIGSYS, signalhandler);
+        
     // Parse commandline
     using namespace optionmm;
     command_line commandline(PACKAGE_NAME, PACKAGE_VERSION,
@@ -133,7 +169,7 @@
     }
 
     // Initialize SDL
-    SDL_Init(SDL_INIT_TIMER);
+    SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER);
     SDL_EnableUNICODE(1);
 
     // Initialize libphysfs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]