Hi Alexander, Could you try either putting the mutex in the global scope or creating a small initializer class that calls getDefaultFont() that gets constructed in the global scope, the OSG has a helper macro for this so you could use:
OSG_INIT_SINGLETON_PROXY(InitDefaultFont, getDefaultFont()) Robert. On 7 April 2015 at 17:41, Alexander Bobkov <[email protected]> wrote: > Hi, > > My osgEarth based application was crashing from time to time (3-4 times a > day). It was not easy to debug. But eventually I've caught the problem > place in Release with Debug info mode. > > DatabasePager thread crashed in osgText/Font.cpp file in the function: > > > Code: > osg::ref_ptr<Font>& Font::getDefaultFont() > { > static OpenThreads::Mutex s_DefaultFontMutex; > OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_DefaultFontMutex); > > static osg::ref_ptr<Font> s_defaultFont = new DefaultFont; > return s_defaultFont; > } > > > > I suppose that scoped static variable initialization is not thread-safe. > > Perhaps the s_DefaultFontMutex variable should be the global. > > Regards, > Alexander > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=63290#63290 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

