Hi Robert,

Robert Osfield wrote:
The problem in your example is your circular dependency.  Right off
the bat you've created a memory leak as this subgraph. The fact that
you then hit a circular reference in the internal patent management is
perhaps not too surprising either.
Right, although I'm not really worried about the cycles as this is just for a small short-running tool.
You shouldn't create ownership cycles like this in your data
structures, instead you need to break them vai the use of
osg::observer_ptr<> or C pointers.  Once you do this you'll probably
avoid all the other problems you are introducing.  If your case I'd
create a UserData object that has a observer_ptr<> to the node you
want to refer to, this way you should be able attach it anywhere in
your scene graph without issues without onwership.
I indeed now use a Referenced-subclass that has a pointer to the actual class I want to reference.

Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to