Changeset 11071 for code/trunk/src/libraries/util/SignalHandler.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/util/SignalHandler.cc
r9682 r11071 44 44 namespace orxonox 45 45 { 46 SignalHandler* SignalHandler::singletonPtr_s = NULL;46 SignalHandler* SignalHandler::singletonPtr_s = nullptr; 47 47 } 48 48 … … 81 81 void SignalHandler::dontCatch() 82 82 { 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 ); 86 86 } 87 87 … … 127 127 } 128 128 // if the signalhandler has already been destroyed then don't do anything 129 if( SignalHandler::singletonPtr_s == 0)129 if( SignalHandler::singletonPtr_s == nullptr ) 130 130 { 131 131 orxout(user_error) << "Received signal " << sigName.c_str() << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl; … … 133 133 } 134 134 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 ); 138 138 } 139 139 … … 175 175 dup2( gdbErr[1], STDERR_FILENO ); 176 176 177 execlp( "sh", "sh", "-c", "gdb", static_cast<void*>( NULL));177 execlp( "sh", "sh", "-c", "gdb", static_cast<void*>(nullptr)); 178 178 } 179 179 … … 186 186 perror("pipe failed!\n"); 187 187 kill( gdbPid, SIGTERM ); 188 waitpid( gdbPid, NULL, 0 );188 waitpid( gdbPid, nullptr, 0 ); 189 189 exit(EXIT_FAILURE); 190 190 } … … 196 196 perror("fork failed!\n"); 197 197 kill( gdbPid, SIGTERM ); 198 waitpid( gdbPid, NULL, 0 );198 waitpid( gdbPid, nullptr, 0 ); 199 199 exit(EXIT_FAILURE); 200 200 } … … 297 297 298 298 299 waitpid( sigPid, NULL, 0 );300 waitpid( gdbPid, NULL, 0 );299 waitpid( sigPid, nullptr, 0 ); 300 waitpid( gdbPid, nullptr, 0 ); 301 301 302 302 int wsRemoved = 0; … … 312 312 bt.erase(0, 1); 313 313 314 time_t now = time( NULL);314 time_t now = time(nullptr); 315 315 316 316 std::string timeString = … … 388 388 SignalHandler::SignalHandler() 389 389 { 390 this->prevExceptionFilter_ = NULL;390 this->prevExceptionFilter_ = nullptr; 391 391 } 392 392 … … 394 394 SignalHandler::~SignalHandler() 395 395 { 396 if (this->prevExceptionFilter_ != NULL)396 if (this->prevExceptionFilter_ != nullptr) 397 397 { 398 398 // Remove the unhandled exception filter function 399 399 SetUnhandledExceptionFilter(this->prevExceptionFilter_); 400 this->prevExceptionFilter_ = NULL;400 this->prevExceptionFilter_ = nullptr; 401 401 } 402 402 } … … 408 408 409 409 // 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) 413 413 { 414 414 // Install the unhandled exception filter function … … 430 430 431 431 // if the signalhandler has already been destroyed then don't do anything 432 if (SignalHandler::singletonPtr_s == 0)432 if (SignalHandler::singletonPtr_s == nullptr) 433 433 { 434 434 orxout(user_error) << "Caught an unhandled exception" << endl << "Can't write backtrace because SignalHandler is already destroyed" << endl; … … 441 441 std::ofstream crashlog(SignalHandler::getInstance().filename_.c_str()); 442 442 443 time_t now = time( NULL);443 time_t now = time(nullptr); 444 444 445 445 crashlog << "=======================================================" << endl; … … 480 480 } 481 481 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. 483 483 /* static */ std::string SignalHandler::getStackTrace(PEXCEPTION_POINTERS pExceptionInfo) 484 484 { … … 625 625 #ifdef ORXONOX_COMPILER_GCC 626 626 int status; 627 char* demangled = __cxxabiv1::__cxa_demangle(symbol->Name, NULL, NULL, &status);627 char* demangled = __cxxabiv1::__cxa_demangle(symbol->Name, nullptr, nullptr, &status); 628 628 if (demangled) 629 629 { … … 684 684 HMODULE hModule; 685 685 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"); 687 687 output += " caused "; 688 688
Note: See TracChangeset
for help on using the changeset viewer.