Hi Robert, Sorry to dredge this one up again, but I think there may be a flaw in the logic of osgViewer::Scene destructor. The intention of the code seems clear, i.e. to remove the Scene being destroyed from the scene cache. For me at least (on Windows & VC 2005) the removal *NEVER* happens. The reason for this appears to be that the code "itr->get()" returns NULL when itr refers to the object currently being destroyed. Which is logical, since if itr is observing 'this' and 'this' is being destroyed, then there must be no remaining ref_ptrs to 'this', and therefore the observer_ptr get function, quite correctly, returns NULL. I think this means that the scene cache vector will continually grow as new scenes are constructed, but not emptied until program termination destroys the static instance of the cache.
I'm not quite sure of the best solution to this is, but the current code is definately not working for me. Cheers. Chris. Code: Scene::~Scene() { OpenThreads::ScopedLock<OpenThreads::Mutex> lock(getSceneCacheMutex()); for(SceneCache::iterator itr = getSceneCache().begin(); itr != getSceneCache().end(); ++itr) { Scene* scene = itr->get(); if (scene==this) { getSceneCache().erase(itr); break; } } } ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41155#41155 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org