]> git.mxchange.org Git - flightgear.git/commitdiff
Trigger segfault/stacktrace to trace memory corruption.
authorThomas Geymayer <tomgey@gmail.com>
Sat, 19 Oct 2013 23:26:32 +0000 (01:26 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sat, 19 Oct 2013 23:26:32 +0000 (01:26 +0200)
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.

src/Viewer/fg_os_osgviewer.cxx

index ffe10c0e0bb7566b275e613d0c364ea93a57e6ad..9a73847dcc8ad7599f3a94591759e27b829a5d27 100644 (file)
@@ -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: