>  Just use ref_ptr<> for all your reference to scene graph objects, be it 
> nodes, geometry or state
> and you'll be fine, no memory leaks no dangling pointers.  The only thing to 
> watch for is circular
> references, which can be solved used osg::observer_ptr<>. 

Understood, and this is what I do.

However, what I was wondering about would still hold true (I think) even if 
ref_ptr was
used.  If the code holding the ref_ptr to the VertexArray didn't know that some 
other
code had removed the parent object, the VertexArray would still remain 
referenced
while the Geometry / Geode around it was removed.

What I was wondering is if unreferencing down the children would continue right
past the (still referenced) VertexArray in the Geometry (removing everything 
except
the VertexArray), or if hitting a Geometry with a still-referenced VertexArray 
would
perhaps cause the parent Geode to remain.

If just the VertexArray remained, then eventually the ref_ptr holding it 
referenced
would allow the VertexArray to be removed.

But, if there are ramifications to a Geometry not being able to free its 
VertexArray
(due to someone holding a still-referenced pointer or ref_ptr), then eventually 
freeing
up the VertexArray might leave other "stuff" orphaned.

In any case, the inter-relatedness was the issue I was curious about.

Thanks,
Bill Prendergast


_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to