Hi, Yasser osg ref_ptr's are intrusive, and object's reference count get's incremented every time you create ref_ptr to this object, and it decrease every time this ref_ptr destroyed. Inside osg all objects that keep pointers on other objects use ref_ptr's for that purpose, so if you pass simple pointer to some osg object it'll be refcounted correctly. You can not use delete on objects pointer that can be wrapped in ref_ptr because they have protected destructor and free when there are no more references to them. If you get pointer and need to be sure that it will be valid over time, you should create ref_ptr out of this pointer (thus increasing ref count) and keep it instead. In general if you create osg objects that can be wrapped into ref_ptr's you should make ref_ptr out of object's pointer at some point (though this can happen inside osg code if you pass pointer to some osg object which keeps it with ref_ptr) or they will not be destructed.
Cheers, Sergey. 16.03.2011, 23:59, "Yasser Asmi" <ya...@amazon.com>: > I am new to OSG and while I understand the general reference counting rules, > I am having some trouble finding all the ref_ptr rules we should be > following. For instance most examples in OSG do not use ref_ptr on objects > and also do not free them. Sometime, these objects (Geometry, Vec3Array etc) > are passed to methods. It is not clear if the methods are refcounting etc. > Stepping through the source is a way to find out but I am looking for general > guidance. Is there a resource that talks about it? > > Thank you! > > Cheers, > Yasser > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=37666#37666 > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org