* Erik Hofman -- Saturday 14 May 2005 23:18:
> I think this might have something to do with a recent GUI code change.
No. It was one part of my bugfix for the property system. I had explained this a
few messages earlier in this thread. I explain again. Although we (or I at
least)
didn't know it, the property system acted like this:
(0) removeChild() didn't *really* remove the node, but only mark it as REMOVED
(which is OK and done for performance reasons)
(1) but neither value, nor node type were cleared, so that
(2) if you created a new node under the name of the removed node, it inherited
the old type, and that couldn't be changed any more. Once bool, always bool.
(3) foo->getNode("removed_node") didn't return 0 as it should, but the address
of the removed node. And foo->getIntValue("removed_node", 43) didn't really
return 43 (as the dialog code understandably assumes), but simply the value
that
the removed node had last.
Reverting that part of the patch (see below), would make everything "work"
again. That is: it would restore bugs (1) and (2), while (3) was there with and
without the patch: No, the default value for the removed node would still not
be used (as Andy had hoped), but rather the last value of the removed node.
If we are aware of the brokenness, we can certainly live with it (although
with a bad feeling on my part).
Luckily, the other part of the fix does work and was the real reason why I
wrote the patch: allowing to redefine key bindings in *-set.xml files.
> I get the feeling we might be better off reverting that particular patch.
Yes, no problem. But please, all of you: stay away from the crap that is
called "removeChild()". It's broken. Better add a bug message there, or
even abort().
RCS file: /var/cvs/SimGear-0.3/SimGear/simgear/props/props.cxx,v
retrieving revision 1.8
diff -u -p -r1.8 props.cxx
--- props.cxx 9 May 2005 14:31:41 -0000 1.8
+++ props.cxx 14 May 2005 21:23:47 -0000
@@ -928,7 +928,7 @@ SGPropertyNode::removeChild (const char
_removedChildren.push_back(node);
}
node->setAttribute(REMOVED, true);
- node->clearValue();
+ //node->clearValue();
ret = node;
fireChildRemoved(node);
}
Sigh.
m.
_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d