[osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Vincent Bourdier
Hi all, I'm making some function to modify graph after some operation, and so I need to call some simple actions in functions. The problem is about ref_ptr : I need to do this : osg::ref_ptrosg::Group mygroup; [..] mygroup = NULL; [...] To do that in a function, I use someting like :

Re: [osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Robert Osfield
Hi Vincent, I don't know if anyone else can make sense of what you are trying to do, based on your email, but I'm just lost. I kinda doubt the problem is really about ref_ptr, but something related to the overall code that you have written, but since I can't really spot what you intend or what

Re: [osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Peter Hrenka
Hi Vincent, Vincent Bourdier schrieb: Hi all, I'm making some function to modify graph after some operation, and so I need to call some simple actions in functions. The problem is about ref_ptr : I need to do this : osg::ref_ptrosg::Group mygroup; [..] mygroup = NULL;

Re: [osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Paul Melis
Vincent Bourdier wrote: Hi Robert I've a ref_ptr to put to NULL, but I can't do a simple my_refptr = NULL; I need to set it in a function. In argument of my function, I get a ref_ptr, and in the function, I put this ref_ptr to NULL; I do not return anything. Perhaps ref_ptr::release()?

Re: [osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Vincent Bourdier
Hi I'm not sure to understand what release() do... T* release() { T* tmp=_ptr; if (_ptr) _ptr-unref_nodelete(); _ptr=0; return tmp; } what does unref_nodelete() do ? what does it return really ? Thanks Vincent. 2008/5/23 Paul Melis [EMAIL PROTECTED]: Vincent Bourdier wrote: Hi Robert

Re: [osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Stephane Lamoliatte
Vincent Bourdier a écrit : In argument of my function, I get a ref_ptr, and in the function, I put this ref_ptr to NULL; but at the end (going out of the function), my original ref_ptr hasn't been modified... Do you pass your ref_ptr by value or by reference ? Here is an example :

Re: [osg-users] osg::ref_ptr difficulties

2008-05-23 Thread Vincent Bourdier
Thanks for all, I'll try with reference and not by copy (I didn't think about that) Thanks Regards, Vincent. 2008/5/23 Paul Melis [EMAIL PROTECTED]: Are you sure you understand the basic concept that ref_ptr together with osg::Referenced implements? You might want to read