[osg-users] osgText crash
Robert Osfield
robert.osfield at gmail.com
Thu Apr 9 03:41:34 PDT 2015
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 <alexander.e.bobkov at gmail.com>
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
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150409/0f51d29b/attachment-0003.htm>
More information about the osg-users
mailing list