From 3dc81ee1331d1b37ee85be9bf0d843e3b6827a2d Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 30 Sep 2009 21:55:21 +0000 Subject: Add explicit reference-counting base class git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11785 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 4 ++-- src/modules/m_spanningtree/main.h | 2 +- src/modules/m_spanningtree/utils.cpp | 7 ++++--- src/modules/m_spanningtree/utils.h | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index db40c7f6a..501baa290 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -939,9 +939,9 @@ void ModuleSpanningTree::OnEvent(Event* event) } } -void ModuleSpanningTree::cull() +bool ModuleSpanningTree::cull() { - Utils->cull(); + return Utils->cull(); } ModuleSpanningTree::~ModuleSpanningTree() diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 6e3f62056..429c0d4bd 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -191,7 +191,7 @@ class ModuleSpanningTree : public Module void OnEvent(Event* event); void OnLoadModule(Module* mod,const std::string &name); void OnUnloadModule(Module* mod,const std::string &name); - void cull(); + bool cull(); ~ModuleSpanningTree(); Version GetVersion(); void Prioritize(); diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index fc5356c66..6f94ead60 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -157,7 +157,7 @@ SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C) this->ReadConfiguration(true); } -void SpanningTreeUtilities::cull() +bool SpanningTreeUtilities::cull() { for (unsigned int i = 0; i < Bindings.size(); i++) { @@ -175,7 +175,9 @@ void SpanningTreeUtilities::cull() } ServerUser->uuid = TreeRoot->GetID(); - ServerUser->cull(); + if (ServerUser->cull()) + delete ServerUser; + return true; } SpanningTreeUtilities::~SpanningTreeUtilities() @@ -186,7 +188,6 @@ SpanningTreeUtilities::~SpanningTreeUtilities() } delete TreeRoot; - delete ServerUser; } void SpanningTreeUtilities::AddThisServer(TreeServer* server, TreeServerList &list) diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 1de6de076..d1922ed75 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -166,7 +166,7 @@ class SpanningTreeUtilities : public classbase /** Prepare for class destruction */ - void cull(); + bool cull(); /** Destroy class and free listeners etc */ -- cgit v1.2.3