On 2/11/10 17:40 , Lv Qing wrote:
> //setup the nodecallback,no problem
> 
> node -> setUpdateCallBack(nc );
> 
> //remove the nodecallback,no problem
> 
> node -> setUpdateCallBack(NULL);
> or 
> node -> removeUpdateCallBack(nc );
> 
> //want to release the osg::NodeCallback* memory ,crash every time!
> if (nc ) delete nc; 

Yeah, don't do that.

> Don't know why,need help!

You're holding a raw pointer to a reference counted object.  The reference 
count drops to
zero when you call 'setUpdateCallback(NULL)' or 'removeUpdateCallback()' which 
deletes the
object.  When you then call 'delete nc' you try to delete an already deleted 
object.

Use osg::ref_ptr.

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

Reply via email to