]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/props.cxx
- new FSF addresses
[simgear.git] / simgear / props / props.cxx
index 2f26f2a697648a12f9b154614f49b4f493b08eac..322a09cdd24d9a3e52ab1d9aff0a781be23324c6 100644 (file)
@@ -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<SGPropertyNode_ptr> nodes)
+find_child (const char * name, int index, const vector<SGPropertyNode_ptr>& nodes)
 {
   int nNodes = nodes.size();
   for (int i = 0; i < nNodes; i++) {
@@ -574,6 +574,7 @@ SGPropertyNode::make_string () const
   case DOUBLE:
     {
       stringstream sstr;
+      sstr.precision( 10 );
       sstr << get_double();
       _buffer = sstr.str();
       return _buffer.c_str();
@@ -748,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;