From: ehofman Date: Sat, 4 Mar 2006 12:46:29 +0000 (+0000) Subject: Mathias Fröhlich: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1cbceec0e1f2fcbdbf9d118998f022fd0345c8d6;p=simgear.git Mathias Fröhlich: zero out all parent pointers, else they might be dangling. --- 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;