From e6649f13553bbf0b61910766827919f531c31115 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 24 Oct 2009 15:05:51 +0000 Subject: 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 --- src/modules/m_spanningtree/treeserver.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/modules/m_spanningtree') 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::iterator a = Children.begin(); a != Children.end(); a++) - { - TreeServer* s = (TreeServer*)*a; - s->Tidy(); - Children.erase(a); - delete s; - stillchildren = true; - break; - } + std::vector::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() -- cgit v1.2.3