[Orxonox-commit 604] r3136 - branches/netp4/src/util

scheusso at orxonox.net scheusso at orxonox.net
Wed Jun 10 12:24:07 CEST 2009


Author: scheusso
Date: 2009-06-10 12:24:06 +0200 (Wed, 10 Jun 2009)
New Revision: 3136

Modified:
   branches/netp4/src/util/SignalHandler.cc
Log:
fixed an issue with the signal handler (in case that there is a segfault when the signalhandler has already been destroyed)


Modified: branches/netp4/src/util/SignalHandler.cc
===================================================================
--- branches/netp4/src/util/SignalHandler.cc	2009-06-09 22:21:01 UTC (rev 3135)
+++ branches/netp4/src/util/SignalHandler.cc	2009-06-10 10:24:06 UTC (rev 3136)
@@ -106,11 +106,6 @@
      */
     void SignalHandler::sigHandler( int sig )
     {
-      for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
-      {
-        (*(it->cb))( it->someData );
-      }
-
       std::string sigName = "UNKNOWN";
 
       switch ( sig )
@@ -125,7 +120,19 @@
           sigName = "SIGILL";
           break;
       }
+      // if the signalhandler has already been destroyed then don't do anything
+      if( SignalHandler::singletonRef_s == 0 )
+      {
+        COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "can't write backtrace because SignalHandler already destroyed" << std::endl;
+        exit(EXIT_FAILURE);
+      }
 
+      for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
+      {
+        (*(it->cb))( it->someData );
+      }
+
+
       COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "try to write backtrace to file orxonox_crash.log" << std::endl;
 
       int sigPipe[2];




More information about the Orxonox-commit mailing list