From 39f683b2729daa3c92b27c5f934878c96bec4535 Mon Sep 17 00:00:00 2001 From: fredb Date: Fri, 26 Jan 2007 20:30:02 +0000 Subject: [PATCH] Ensure a reference on the cube map texture is always held --- simgear/scene/model/shadanim.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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) -- 2.39.5