I'm having trouble with a segfault in VTP's glutsimple application, but it
looks like the problem traces back into OSG. For reference, I'm using OSG
2.2.0 on Fedora 9, and VTP 080506.

Here's a backtrace:

ScopedLock                                      OpenThreads/ScopedLock:31
osg::Referenced::ref                            osg/Referenced:128
osg::ref_ptr<osg::MatrixTransform>::operator=   osg/ref_ptr:50
vtTransform                                     NodeOSG.cpp:1223
...

The problem occurs when the osg::MatrixTransform* is assigned to an
osg::ref_ptr and in particular when the ref_ptr assignment tries to lock
the mutex. It appears that the mutex protected member
Referenced._refMutex._prvData is a null pointer.

Here's a modified piece of code from VTP replacing the vtTransform
constructor that results in a segfault:

vtTransform::vtTransform() : vtGroup(true), vtTransformBase()
{
  // Constructs a transform where Referenced._refMutex._prvData is null
  osg::MatrixTransform* pxform = new osg::MatrixTransform;

  // segfaults on locking since _prvData is null
  osg::ref_ptr<MatrixTransform> rpxform = pxform;

  m_pTransform = pxform;
  SetOsgGroup(m_pTransform);
}

Tracing a bit deeper, the problem seems to be somewhere between the
osg::MatrixTransform and osg::Transform constructors, but I'm not sure how
or where.

Inspecting Referenced._refMutex._prvData after the osg::Transform
constructor has completed, Referenced._refMutex = 0x1cb8e70 and
Referenced._refMutex._prvData = 0x1cb8e90 (both valid pointers).

But, at the end of the osg::MatrixTransform constructor
Referenced._refMutex still has it's valid pointer to 0x1cb8e70 but now
Referenced._refMutx._prvData is now 0x00 (null).

Anyone else encountered this? BTW, I tried OSG 2.4 and experienced the
same behavior.

Thanks,

Rick



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to