Utils/Console: Reset GenericNode::parent_ when destroying parent
g0dil [Fri, 20 Feb 2009 23:22:41 +0000 (23:22 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1132 270642c3-0616-0410-b53a-bc976706d245

Utils/Console/Node.cc
Utils/Console/Node.hh

index 5096ba8..41c1779 100644 (file)
@@ -102,6 +102,14 @@ prefix_ void senf::console::LinkNode::v_help(std::ostream & os)
 ///////////////////////////////////////////////////////////////////////////
 //senf::console::DirectoryNode
 
+prefix_ senf::console::DirectoryNode::~DirectoryNode()
+{
+    ChildMap::iterator i (children_.begin());
+    ChildMap::iterator const i_end (children_.end());
+    for (; i != i_end; ++i)
+        i->second->parent_ = 0;
+}
+
 prefix_ senf::console::GenericNode::ptr
 senf::console::DirectoryNode::remove(std::string const & name)
 {
index 0367f5a..fcd44d0 100644 (file)
@@ -436,6 +436,7 @@ namespace console {
         static ptr create();            ///< Create node object.
                                         /**< You should normally use either mkdir() or
                                              ScopedDirectory instead of create() */
+        ~DirectoryNode();
 
         ///\}
         ///////////////////////////////////////////////////////////////////////////