From: fredb Date: Fri, 26 Jan 2007 20:30:02 +0000 (+0000) Subject: Ensure a reference on the cube map texture is always held X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=39f683b2729daa3c92b27c5f934878c96bec4535;p=simgear.git Ensure a reference on the cube map texture is always held --- diff --git a/simgear/scene/model/shadanim.cxx b/simgear/scene/model/shadanim.cxx index cffae0ff..b631c7d5 100644 --- a/simgear/scene/model/shadanim.cxx +++ b/simgear/scene/model/shadanim.cxx @@ -126,14 +126,12 @@ private: static osg::TextureCubeMap* getOrCreateTextureCubeMap() { - static osg::TextureCubeMap* textureCubeMap = 0; - if (textureCubeMap) - return textureCubeMap; + static osg::ref_ptr textureCubeMap; static SGMutex mutex; SGGuard locker(mutex); - if (textureCubeMap) - return textureCubeMap; + if (textureCubeMap.get()) + return textureCubeMap.get(); // create and setup the texture object textureCubeMap = new osg::TextureCubeMap; @@ -146,7 +144,7 @@ getOrCreateTextureCubeMap() textureCubeMap->setUpdateCallback(new SGMapGenCallback); - return textureCubeMap; + return textureCubeMap.get(); } static void create_specular_highlights(osg::Node *node)