|
Hi all, what is the correct way to delete objects from heap in openscenegraph ? Since all destructors are protected for all classes derived from Referenced, so I cannot delete the objects created on heap and nor can I create object on stack. Thus the only way is to create using new and assign in a ref_ptr. Now the problem is if I have already something inside the ref_ptr and I want to put something else in it then how shall I tell ref_ptr to delete it? AFAIK, one should not use the release method of ref_ptr to delete the object. So what option am I left with? To be more precise in the code below I am loading a scenegraph from a file and the point to it by a ref_ptr m_loadedModel. Now assume that I already have a scenegraph loaded , then isn't it I need to unload or delete the scenegraph that is already loaded? osg::ref_ptr<osg::Node> m_loadedModel; //Shouldn't I delete the scenegraph if it is already loaded in the m_loadedModel ??? m_loadedModel = osgDB::readNodeFile(fileName.c_str()); Hope my question is clear, Thanks for reply, Divick |
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
