From 796acb9092519dcd71794f49121134f3c6b656cb Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Fri, 10 Apr 2015 23:49:50 +0200 Subject: [PATCH] Always log message if going to segfault during notify logging. --- src/Viewer/fg_os_osgviewer.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Viewer/fg_os_osgviewer.cxx b/src/Viewer/fg_os_osgviewer.cxx index b925045aa..498735fed 100644 --- a/src/Viewer/fg_os_osgviewer.cxx +++ b/src/Viewer/fg_os_osgviewer.cxx @@ -190,18 +190,19 @@ public: // that internally, so we simply pass the message on. virtual void notify(osg::NotifySeverity severity, const char *message) { - SG_LOG(SG_GL, translateSeverity(severity), message); - // Detect whether a osg::Reference derived object is deleted with a non-zero // reference count. In this case trigger a segfault to get a stack trace. if( strstr(message, "the final reference count was") ) { - + // as this is going to segfault ignore the translation of severity and always output the message. + SG_LOG(SG_GL, SG_ALERT, message); int* trigger_segfault = 0; *trigger_segfault = 0; + return; } + SG_LOG(SG_GL, translateSeverity(severity), message); } - + private: sgDebugPriority translateSeverity(osg::NotifySeverity severity) { -- 2.39.5