Re: [osg-users] ref_ptr rules

2011-03-31 Thread paul art
Hi, ... Thanks. That makes sense.I will working on it!! Thank you! Cheers, paul 8)' -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37772#37772 ___ osg-users mailing list osg-users@lists.openscenegr

Re: [osg-users] ref_ptr rules

2011-03-17 Thread Frederic Bouvier
Using ref_ptr everywhere is a good way to be exception safe because you know the pointer will be deleted even it it wasn't added to another OSG object. There is a possible pitfall if you want to return a ref_ptr in a function that returns a pointer, because the object will be deleted before the

Re: [osg-users] ref_ptr rules

2011-03-17 Thread Glenn Waldron
Old, but still relevant, write-up on ref_ptr: http://andesengineering.com/OSG_ProducerArticles/RefPointers/RefPointers.html Glenn Waldron / Pelican Mapping / 703.652.4791 / @glennwaldron 2011/3/16 Sergey Polischuk

Re: [osg-users] ref_ptr rules

2011-03-16 Thread Ulrich Hertlein
On 17/03/11 11:33 , Yasser Asmi wrote: > Thanks. That makes sense but I still have a question. > > If I am createing a new OSG object in my code, say osg:Geometry, and I know > it will be > passed to a osg method at some point. How do I know if I should or should > not wrap it > in ref_ptr? I

Re: [osg-users] ref_ptr rules

2011-03-16 Thread Yasser Asmi
Thanks. That makes sense but I still have a question. If I am createing a new OSG object in my code, say osg:Geometry, and I know it will be passed to a osg method at some point. How do I know if I should or should not wrap it in ref_ptr? I'd think we should wrap it. But I have seen a lot o

Re: [osg-users] ref_ptr rules

2011-03-16 Thread Sergey Polischuk
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 simpl

[osg-users] ref_ptr rules

2011-03-16 Thread Yasser Asmi
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 et