From: timoore Date: Fri, 29 Aug 2008 07:39:05 +0000 (+0000) Subject: Don't use osgDB::SharedStateManager::share in SGLoadTexture2D X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=12495547c44ec4bd04384f84613c64f7b8f012ad;p=simgear.git Don't use osgDB::SharedStateManager::share in SGLoadTexture2D It is not safe to call this function from the database pager thread; in any event, state sets and textures created in the database pager will get passed through the SharedStateManager anyway. --- diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index aece3e2d..54e74924 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -56,26 +56,6 @@ SGLoadTexture2D(bool staticTexture, const std::string& path, } } - // Make sure the texture is shared if we already have the same texture - // somewhere ... - { - osg::ref_ptr tmpNode = new osg::Node; - osg::StateSet* stateSet = tmpNode->getOrCreateStateSet(); - stateSet->setTextureAttribute(0, texture.get()); - - // OSGFIXME: don't forget that mutex here - osgDB::Registry* registry = osgDB::Registry::instance(); - registry->getSharedStateManager()->share(tmpNode.get(), 0); - - // should be the same, but be paranoid ... - stateSet = tmpNode->getStateSet(); - osg::StateAttribute* stateAttr; - stateAttr = stateSet->getTextureAttribute(0, osg::StateAttribute::TEXTURE); - osg::Texture2D* texture2D = dynamic_cast(stateAttr); - if (texture2D) - texture = texture2D; - } - return texture.release(); }