From a93629a127dcaf097ce32251bfbf5a9fd6fe4c6a Mon Sep 17 00:00:00 2001 From: Scott Giese Date: Sun, 9 Aug 2020 09:39:04 -0500 Subject: [PATCH] Revert "Memory Leak: 95 MB" This reverts commit cb54815cfc42be38c6d5720cb71518daffef2b42. --- simgear/props/props.cxx | 7 +++---- simgear/props/props.hxx | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx index 43142b4d..433c80fe 100755 --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -973,10 +973,9 @@ SGPropertyNode::SGPropertyNode( const std::string& name, */ SGPropertyNode::~SGPropertyNode () { - // REVIEW: Memory Leak: 95 MB - // 99,418,032 bytes in 654,066 blocks are still reachable in loss record 15,500 of 15,501 - removeAllChildren(); - + // zero out all parent pointers, else they might be dangling + for (unsigned i = 0; i < _children.size(); ++i) + _children[i]->_parent = 0; clearValue(); if (_listeners) { diff --git a/simgear/props/props.hxx b/simgear/props/props.hxx index 08216a23..8ee640ae 100644 --- a/simgear/props/props.hxx +++ b/simgear/props/props.hxx @@ -2045,6 +2045,7 @@ T SGPropertyNode::getValue(typename std::enable_if(make_string()); + break; default: // avoid compiler warning break; }