Re: [osg-users] manual delete object

2009-06-02 Thread Rabbi Robinson
Hi, Thanks, your hint already gave it all out. I was wondering if user need to keep track of the reference to Node assigned to Group. As you said, group use smart pointer internally so group-addChild(new Node) will delete the node created once group is gone. Thank you! Cheers, Rabbi

[osg-users] manual delete object

2009-06-01 Thread Rabbi Robinson
Hi, When I tried Node* node = new Node; delete node; there is a compiler error saying destructor protected. How can I delete node that I am sure I no longer use. Thank you! Cheers, Rabbi -- Read this topic online here:

Re: [osg-users] manual delete object

2009-06-01 Thread Tomlinson, Gordon
-users] manual delete object Hi, When I tried Node* node = new Node; delete node; there is a compiler error saying destructor protected. How can I delete node that I am sure I no longer use. Thank you! Cheers, Rabbi -- Read this topic online here: http://forum.openscenegraph.org

Re: [osg-users] manual delete object

2009-06-01 Thread Robert Osfield
Hi Rabbi, The destructor of most OSG class is deliberately made protected so your can't delete it directly using delete, it also prevents the class from being created on the stack. Why? This is a C++ programming trick that can help prevent misue of C++ classes that are reference counted, and

Re: [osg-users] manual delete object

2009-06-01 Thread Rabbi Robinson
Hi, Thanks, if later I reference the node from a group, will the reference count be increased for the node? { osg::ref_ptrNode node = new Node; osg::ref_ptrGroup group = new Group; group-addChild(node); } The reference count of node should be one outside the scope. Is it right that somehow

Re: [osg-users] manual delete object

2009-06-01 Thread Robert Osfield
On Mon, Jun 1, 2009 at 4:39 PM, Rabbi Robinson longa...@gmail.com wrote: Hi, Thanks, if later I reference the node from a group, will the reference count be increased for the node? { osg::ref_ptrNode node = new Node; osg::ref_ptrGroup group = new Group; group-addChild(node); } The