From abc0b5b10d4d7a485eef891333a1d2397d01953d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 21 Jun 2009 17:28:59 +0000 Subject: [PATCH] Added mutex lock to iniGLNames to prevent threading problems during initialization --- src/osgPlugins/osg/StateSet.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/osgPlugins/osg/StateSet.cpp b/src/osgPlugins/osg/StateSet.cpp index 0dfd8a3b5..8ac5005a0 100644 --- a/src/osgPlugins/osg/StateSet.cpp +++ b/src/osgPlugins/osg/StateSet.cpp @@ -7,6 +7,9 @@ #include #include +#include +#include + #include #include @@ -65,6 +68,11 @@ void initGLNames() { static bool first_time = true; if (!first_time) return; + + static OpenThreads::Mutex s_initGLNames; + OpenThreads::ScopedLock lock(s_initGLNames); + + if (!first_time) return; ADD_NAME("GL_ALPHA_TEST",GL_ALPHA_TEST) ADD_NAME("GL_BLEND",GL_BLEND)