[osg-users] Multithreading crash due to osgDb::Registry::instance()

I-Nixon, Anthony D anthony.d.nixon at boeing.com
Mon Mar 16 23:25:38 PDT 2009

I've encountered a crash when using CompositeViewer in Multithreaded
mode due to concurrent access to osgDb::Registry::instance().

The usage scenario is having two views (that have an empty scene graph -
since no data has been loaded, osgdb::Registry::instance() hasn't yet
been called).

On the first frame, each of the render threads calls
osgDb::Registry::instance(), and one gets back a null pointer (which is
kind of bad for an instance :-)

The fix for me is easy - just call osgDb::Registry::instance() sometime
before starting rendering, but a more general solution would be better,
of course.

This is with OSG 2.8.0 - although there don't appear to have been any
changes in this area in the trunk, either.

I've only confirmed this on Windows XP and Visual C++ 8. 

Anthony Nixon

More information about the osg-users mailing list