Hi Charles,

When I referred to "destroy", what I'm doing is calling 'delete' on the classes 
that contain the ref_ptrs.  For instance, I call delete on my view class, and in the view 
class' destructor, I (eventually) call delete on the drawables. So I'm in effect doing 
what you're saying, with the exception of the class containing the composite viewer.  
I'll change some code around to reflect that and see how it goes.

One thing you need to be careful of when deriving classes from OSG base classes which themselves derive from osg::Referenced ... In most cases, the destructors of those classes should be protected. Since they're normally protected already (as in osg::Object, osg::Drawable, etc) you shouldn't expose them in public scope in your derived class, which would allow them to be (erroneously) deleted at any time by the application instead of being deleted automatically when their ref count goes down to 0.

I've had a similar problem once, which was being caused by a double-delete. I was manually deleting a custom drawable or node (I can't remember) and then since it was still in the scene graph, it was being deleted when the viewer went out of scope too.

In general, trust ref_ptr to manage anything derived from osg::Referenced.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  • [osg-use... Cole, Charles E. (LARC-B702)[RAYTHEON TECHNICAL SERVICES COMPANY]
    • Re:... Cole, Charles E. (LARC-B702)[RAYTHEON TECHNICAL SERVICES COMPANY]
    • Re:... Jean-Sébastien Guay
      • ... Cole, Charles E. (LARC-B702)[RAYTHEON TECHNICAL SERVICES COMPANY]
        • ... Jean-Sébastien Guay
          • ... Cole, Charles E. (LARC-B702)[RAYTHEON TECHNICAL SERVICES COMPANY]
            • ... Jean-Sébastien Guay
    • Re:... David Spilling
      • ... Cole, Charles E. (LARC-B702)[RAYTHEON TECHNICAL SERVICES COMPANY]

Reply via email to