1
0
Fork 0

Always log message if going to segfault during notify logging.

This commit is contained in:
Richard Harrison 2015-04-10 23:49:50 +02:00
parent 9ba892962c
commit 796acb9092

View file

@ -190,18 +190,19 @@ public:
// that internally, so we simply pass the message on. // that internally, so we simply pass the message on.
virtual void notify(osg::NotifySeverity severity, const char *message) 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 // 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. // reference count. In this case trigger a segfault to get a stack trace.
if( strstr(message, "the final reference count was") ) 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; int* trigger_segfault = 0;
*trigger_segfault = 0; *trigger_segfault = 0;
return;
} }
SG_LOG(SG_GL, translateSeverity(severity), message);
} }
private: private:
sgDebugPriority translateSeverity(osg::NotifySeverity severity) sgDebugPriority translateSeverity(osg::NotifySeverity severity)
{ {