Selon Melchior FRANZ:

> > it was copied in the _removedChild vector before
> > returning, hence incrementing the counter. If you don't care having
> > aliases pointing to garbage ( something David was against ), you would
> > just have to dump the _removedChild vector and, if the
> > SGPropertyNode_ptr returned is not used, the tree should be destroyed.
> > Two functions shouldn't be necessary.
>
> It would have to do this recursively. Because neither SGPropertyNode_ptr
> nor SGPropertryNode do AFAIK destroy their children on destruction. (And I
> don't know if this would be desirable.)

For a reason : it is the job of SGPropertyNode_ptr destructor :

SGPropertyNode_ptr::~SGPropertyNode_ptr()
{
 if (_ptr && _ptr->decrementRef() == 0)
   delete _ptr;
}

If the vector of children SGPropertyNode_ptr is properly cleared in the SGPropertyNode destructor, the whole tree should go away recursively.

-Fred



_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to