The short answer to your problem is probably "yes", but here are some important details. A Group node maintains a std::list of ref_ptrs. When you addChild, a new ref_ptr is created, made to point at the child (which refs the child), and then pushed onto the Group's child list. When you delete the only ref_ptr to the top of your scene graph, it decrements the ref count for the root node. Since that will now be zero, its destructor gets called, which deletes all its member variables, including its std::list of ref_ptrs to its children. As each ref_ptr is deleted off the list, it decrements the ref count of the child it points to. And if those ref counts go to zero, then you have this cascading effect. >From this, you can see that if you have another ref_ptr anywhere else referencing one of the nodes in your subtree, then it would be the case that the entire subtree is NOT deleted. I hope that helps. -Paul
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Argentieri, John-P63223 Sent: Tuesday, December 19, 2006 1:48 PM To: osg users Subject: [osg-users] Very Simple ref_ptr question Hello Robert and Gang. I have just begun using ref_ptr's and I (mostly) read the Don Burns ref_ptr's manual. From what I can tell, osg::Group's addchild method ref()'s the ref_ptr. It would make sense then that removeChild unref()'s it. My question is, If I execute a removeChild() on the parent of a subtree, are all the nodes in the subtree unref()'ed as well? Thanks and have a wonderful day. John
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
