[osg-users] Problems shutting down Composite Viewer/View/Custom drawables

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Fri Mar 27 10:45:12 PDT 2009

Hi Charles,

> My attempted process to close is that I (1) set a flag on a render thread to stop calling viewer->frame (very similar to setDone(true)); (2) destroy the loaded drawables and free their associated libraries; (3) destroy the view, and thus it's associated camera and graphics context; and (4) destroy the composite viewer.  I use reference pointers in every case except for the composite viewer (although I've tried a reference pointer for it as well, but still get the same result).

Just wondering, if you're using ref_ptrs, why don't you just let the 
CompositeViewer's ref_ptr go out of scope (or delete the object that has 
the ref_ptr<CompositeViewer>) and be done with it? That should cascade 
down, destroying the views, then each view's scene graph. And if your 
custom drawables do the right thing in their destructors, that should be 
taken care of too. You shouldn't have to manage destruction order yourself.

Perhaps I'm missing something here, but that generally just works.

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list