Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/util/SignalHandler.cc

    r9682 r11071  
    4444namespace orxonox
    4545{
    46     SignalHandler* SignalHandler::singletonPtr_s = NULL;
     46    SignalHandler* SignalHandler::singletonPtr_s = nullptr;
    4747}
    4848
     
    8181    void SignalHandler::dontCatch()
    8282    {
    83       for ( SignalRecList::iterator it = sigRecList.begin(); it != sigRecList.end(); it++ )
    84       {
    85         signal( it->signal, it->handler );
     83      for (const SignalRec& sigRec : sigRecList)
     84      {
     85        signal( sigRec.signal, sigRec.handler );
    8686      }
    8787
     
    127127      }
    128128      // if the signalhandler has already been destroyed then don't do anything
    129       if( SignalHandler::singletonPtr_s == 0 )
     129      if( SignalHandler::singletonPtr_s == nullptr )
    130130      {
    131131        orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
     
    133133      }
    134134
    135       for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++  )
    136       {
    137         (*(it->cb))( it->someData );
     135      for (const SignalCallbackRec& callback : SignalHandler::getInstance().callbackList)
     136      {
     137        (*(callback.cb))( callback.someData );
    138138      }
    139139
     
    175175        dup2( gdbErr[1], STDERR_FILENO );
    176176
    177         execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(NULL));
     177        execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(nullptr));
    178178      }
    179179
     
    186186        perror("pipe failed!\n");
    187187        kill( gdbPid, SIGTERM );
    188         waitpid( gdbPid, NULL, 0 );
     188        waitpid( gdbPid, nullptr, 0 );
    189189        exit(EXIT_FAILURE);
    190190      }
     
    196196        perror("fork failed!\n");
    197197        kill( gdbPid, SIGTERM );
    198         waitpid( gdbPid, NULL, 0 );
     198        waitpid( gdbPid, nullptr, 0 );
    199199        exit(EXIT_FAILURE);
    200200      }
     
    297297
    298298
    299       waitpid( sigPid, NULL, 0 );
    300       waitpid( gdbPid, NULL, 0 );
     299      waitpid( sigPid, nullptr, 0 );
     300      waitpid( gdbPid, nullptr, 0 );
    301301
    302302      int wsRemoved = 0;
     
    312312        bt.erase(0, 1);
    313313
    314       time_t now = time(NULL);
     314      time_t now = time(nullptr);
    315315
    316316      std::string timeString =
     
    388388    SignalHandler::SignalHandler()
    389389    {
    390         this->prevExceptionFilter_ = NULL;
     390        this->prevExceptionFilter_ = nullptr;
    391391    }
    392392
     
    394394    SignalHandler::~SignalHandler()
    395395    {
    396         if (this->prevExceptionFilter_ != NULL)
     396        if (this->prevExceptionFilter_ != nullptr)
    397397        {
    398398            // Remove the unhandled exception filter function
    399399            SetUnhandledExceptionFilter(this->prevExceptionFilter_);
    400             this->prevExceptionFilter_ = NULL;
     400            this->prevExceptionFilter_ = nullptr;
    401401        }
    402402    }
     
    408408
    409409        // don't register twice
    410         assert(this->prevExceptionFilter_ == NULL);
    411 
    412         if (this->prevExceptionFilter_ == NULL)
     410        assert(this->prevExceptionFilter_ == nullptr);
     411
     412        if (this->prevExceptionFilter_ == nullptr)
    413413        {
    414414            // Install the unhandled exception filter function
     
    430430
    431431            // if the signalhandler has already been destroyed then don't do anything
    432             if (SignalHandler::singletonPtr_s == 0)
     432            if (SignalHandler::singletonPtr_s == nullptr)
    433433            {
    434434                orxout(user_error) << "Caught an unhandled exception" << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl;
     
    441441            std::ofstream crashlog(SignalHandler::getInstance().filename_.c_str());
    442442
    443             time_t now = time(NULL);
     443            time_t now = time(nullptr);
    444444
    445445            crashlog << "=======================================================" << endl;
     
    480480    }
    481481
    482     /// Returns the stack trace for either the current function, or, if @a pExceptionInfo is not NULL, for the given exception context.
     482    /// Returns the stack trace for either the current function, or, if @a pExceptionInfo is not nullptr, for the given exception context.
    483483    /* static */ std::string SignalHandler::getStackTrace(PEXCEPTION_POINTERS pExceptionInfo)
    484484    {
     
    625625#ifdef ORXONOX_COMPILER_GCC
    626626                int status;
    627                 char* demangled = __cxxabiv1::__cxa_demangle(symbol->Name, NULL, NULL, &status);
     627                char* demangled = __cxxabiv1::__cxa_demangle(symbol->Name, nullptr, nullptr, &status);
    628628                if (demangled)
    629629                {
     
    684684        HMODULE hModule;
    685685
    686         std::string output = (GetModuleFileName(NULL, szModule, MAX_PATH) ? SignalHandler::getModuleName(szModule) : "Application");
     686        std::string output = (GetModuleFileName(nullptr, szModule, MAX_PATH) ? SignalHandler::getModuleName(szModule) : "Application");
    687687        output += " caused ";
    688688
Note: See TracChangeset for help on using the changeset viewer.