Hi,

I have a question about the osg::ref_ptr things. What is the difference between those two variants (MyClass inherits from the class Referenced):

1:
osg::ref_ptr<MyClass> object1 = new MyClass();
object1.release();

2:
MyClass* object2 = new MyClass();
delete object2;

I have found out, that the 2nd variant deletes the object by calling the destructor. But what about the first variant. Here the destructor is not called. Is the object really deleted?

I have some parts in my code, where I call methods from deleted objects, but nothing happens. Normally the call of these methods should crash the application, because the object is deleted.

regards,
Oliver
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to