Trigger segfault/stacktrace to trace memory corruption.
Catch OSG error message if osg::Reference derived class is deleted with non-zero reference count and trigger a segfault to get a stack trace.
This commit is contained in:
parent
6b88302037
commit
e4b8e1ea07
1 changed files with 9 additions and 0 deletions
|
@ -190,6 +190,15 @@ public:
|
|||
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") )
|
||||
{
|
||||
|
||||
int* trigger_segfault = 0;
|
||||
*trigger_segfault = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue