Rabbi Robinson wrote:
Hi,

Thanks, that explains it. Correct me if I am wrong. So to use it, just create 
osg::ref_ptr<> and use it as regular pointer and the memory will be managed by 
osg::ref_ptr<>.

In a simple case, I careate Node* node = osg::ref_ptr<new Node> and, call void* ptr = node. I suppose the reference count in node will be incremented

Actually, it's like this:

osg::ref_ptr<osg::Node>  node;
node = new osg::Node();


If later I call, ptr = NULL, it doesn't seem that there is anyway to tell node to decrement the reference count in node.

This will decrement the reference count in node. If the reference count goes to zero, it will be deleted.


Can someone clarify how osg::ref_ptr<> behave in this case?

Look at the operator= method in osg::ref_ptr

I'd also recommend looking at the ref_ptr tutorial that others have mentioned.

--"J"

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to