I have now debugged the problem a bit, and it does indeed manifest itself under 
both Win32 debug and release builds. The root of the problem is that the static 
s_renderBinPrototypeList object (osgUtil/RenderBin.cpp line 44) is being 
created before the static s_ReferencedGlobalMutext object (osg/Referenced.cpp 
line 82). Static/global objects are destructed in the reverse order of their 
creation. This causes a problem when destructing s_renderBinPrototypeList, 
since it depends on the already destructed s_ReferencedGlobalMutext object for 
its destruction.

Suggested fix:
Modify Referenced::getGlobalReferencedMutex(), so that it forces 
s_ReferencedGlobalMutext to be created in advance of s_ReferencedGlobalMutext.
--
OpenThreads::Mutex* Referenced::getGlobalReferencedMutex()
{
    // make sure that s_ReferencedGlobalMutext is created in advance,
    // since s_ReferencedGlobalMutext depend on it for its destruction
    osg::Referenced::getGlobalReferencedMutex();
    static OpenThreads::Mutex s_ReferencedGlobalMutext;
    return &s_ReferencedGlobalMutext;
}
--

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=12836#12836





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

Reply via email to