From 1cbceec0e1f2fcbdbf9d118998f022fd0345c8d6 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sat, 4 Mar 2006 12:46:29 +0000 Subject: [PATCH] =?utf8?q?Mathias=20Fr=F6hlich:?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit zero out all parent pointers, else they might be dangling. --- simgear/props/props.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx index 976ba30d..322a09cd 100644 --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -250,7 +250,7 @@ compare_strings (const char * s1, const char * s2) * Locate a child node by name and index. */ static int -find_child (const char * name, int index, vector nodes) +find_child (const char * name, int index, const vector& nodes) { int nNodes = nodes.size(); for (int i = 0; i < nNodes; i++) { @@ -749,6 +749,11 @@ SGPropertyNode::SGPropertyNode (const char * name, */ SGPropertyNode::~SGPropertyNode () { + // zero out all parent pointers, else they might be dangling + for (unsigned i = 0; i < _children.size(); ++i) + _children[i]->_parent = 0; + for (unsigned i = 0; i < _removedChildren.size(); ++i) + _removedChildren[i]->_parent = 0; delete _path_cache; clearValue(); delete _listeners; -- 2.39.5