[osg-submissions] Group::removeChildren fix

Daniel Stien daniel at stien.org
Mon Jan 14 08:55:12 PST 2008


Hi Robert,

childRemoved() didn't seem to serve any purpose if there was no way to
determine which children were affected. You're right, if childRemoved()
is supposed to be fed an index position in _children it should probably
be given a more suitable name. What about childRemoving()?

I'm subclassing Group to encapsulate a third party collision/dynamics  
world,
using childInserted()/childRemoved() to internally add/remove rigid body  
nodes.

--
Daniel Stien

On Mon, 14 Jan 2008 10:38:52 +0100, Robert Osfield  
<robert.osfield at gmail.com> wrote:

> Hi Daniel,
>
> You change looks OK, but given the naming of the method - childRemoved
> gives us the clue that it a child has been removed, rather than about
> to be removed as is your interpretation.  childRemoved is only done
> with the nodes that subclass from Group and override childRemoved to
> handle the update of their local data structures without getting out
> of sync so if there is a problem then its as down to the local
> childRemoved() implementation making an incorrect assumption rather
> than the Group code itself being done in the wrong order.
>
> Despite your fix being not really being a fix, rather masking an bug
> in a sublcass of Group, I have gone ahead and merged it, as there is
> chance that others might make the same mistake.  BTW, did you subclass
> from Group yourself?  I can't find any placing in the core OSG
> distribution that actually override childRemoved() so there are
> instances where an mistake of interpretation has been made.
>
> Robert.
>
>
>
> On Jan 13, 2008 11:11 PM, Daniel Stien <daniel at stien.org> wrote:
>> When removing a child from a osg::Group, childRemoved is called after  
>> the
>> node has already been erased from the node list, causing childRemoved  
>> to be
>> performed on the consecutive node.
>>
>> Lines 180 and 182 are swapped in the attached Group.cpp.
>>
>> --
>> Daniel Stien
>> _______________________________________________
>> osg-submissions mailing list
>> osg-submissions at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>>
>>


More information about the osg-submissions mailing list