diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-24 15:05:51 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-24 15:05:51 +0000 |
commit | e6649f13553bbf0b61910766827919f531c31115 (patch) | |
tree | 44f22aa3c85e69cd94ee0cea70362c1a69557fc7 /src/modules/m_spanningtree/treeserver.cpp | |
parent | b868bb52c55fc902e0acab3c4a43576826817e85 (diff) |
Properly cull TreeServer objects when quitting several of them
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11964 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/treeserver.cpp')
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 38d91f54c..060c958d7 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -333,21 +333,17 @@ bool TreeServer::DelChild(TreeServer* Child) */ bool TreeServer::Tidy() { - bool stillchildren = true; - while (stillchildren) + while (1) { - stillchildren = false; - for (std::vector<TreeServer*>::iterator a = Children.begin(); a != Children.end(); a++) - { - TreeServer* s = (TreeServer*)*a; - s->Tidy(); - Children.erase(a); - delete s; - stillchildren = true; - break; - } + std::vector<TreeServer*>::iterator a = Children.begin(); + if (a == Children.end()) + return true; + TreeServer* s = *a; + s->Tidy(); + s->cull(); + Children.erase(a); + delete s; } - return true; } CullResult TreeServer::cull() |