Hi, as a general rule, if you're using ref_ptr correctly, you should never have to call ref(). I've written much OSG code over the years, and have never had a need to call ref() directly.
The official guidance is to always use ref_ptr when maintaining a pointer to an object derived from osg::Referenced. I chose those words carefully; if you need to preserve/maintain a reference across function calls, or references among different nodes, then always use a ref_ptr. Occasionally, I will use a regular C++ pointer strictly _inside_ a function when I know that reference will not be maintained beyond the scope of that function lifetime. There is a very good ref_ptr tutorial on the OSG website. -- mew On Thu, Jun 19, 2008 at 12:37 PM, Xinyu Zhang <[EMAIL PROTECTED]> wrote: > Thank you. I got the problem solved. > > The program crashed everytime I tried to select a dragger. It actually had > nothing to do with the dragger itself. Just the CommandManager pointer was > somehow unaccessable (deleted?). > > I manually called the ref() and then it worked fine. I paid a lot to learn > the smart pointer. Still don't quite understand when they should be used. Why > many pointers in the examples are just pointers not ref_ptr. > > > ----- Original Message ---- > From: Mike Weiblen <[EMAIL PROTECTED]> > To: OpenSceneGraph Users <[email protected]> > Sent: Thursday, June 19, 2008 12:38:50 PM > Subject: Re: [osg-users] help on picking and draggers? > > there is the osgpick example. > do you have a small example that demonstrates the issues you're struggle with? > -- mew > > > On Thu, Jun 19, 2008 at 8:40 AM, Xinyu Zhang <[EMAIL PROTECTED]> wrote: >> Is there any document or tutorial on how to use picking and draggers in OSG? >> I am struggling on this. Thanks. >> >> >> >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > > > -- > Mike Weiblen -- Austin Texas USA -- http://mew.cx/ > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- Mike Weiblen -- Austin Texas USA -- http://mew.cx/ _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

