From 73221e8682a7ec0ec7a946acd6d64b75e878938a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 22 Dec 2014 09:50:10 +0000 Subject: [PATCH] Added doxygen comment for ref_ptr<>::release(). git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14630 16af8721-9629-0410-8352-f15c8da7e697 --- include/osg/ref_ptr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/osg/ref_ptr b/include/osg/ref_ptr index a141de64c..956cb611e 100644 --- a/include/osg/ref_ptr +++ b/include/osg/ref_ptr @@ -94,6 +94,10 @@ class ref_ptr bool operator!() const { return _ptr==0; } // not required bool valid() const { return _ptr!=0; } + /** release the pointer from ownership by this ref_ptr<>, decrementing the objects refencedCount() via unref_nodelete() to prevent the Object + * object from being deleted even if the reference count goes to zero. Use when using a local ref_ptr<> to an Object that you want to return + * from a function/method via a C pointer, whilst preventing the normal ref_ptr<> destructor from cleaning up the object. When using release() + * you are implicitly expecting other code to take over managment of the object, otherwise a memory leak will result. */ T* release() { T* tmp=_ptr; if (_ptr) _ptr->unref_nodelete(); _ptr=0; return tmp; } void swap(ref_ptr& rp) { T* tmp=_ptr; _ptr=rp._ptr; rp._ptr=tmp; }