diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-19 20:12:12 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-19 20:12:12 +0000 |
commit | aa7cc18468f4b16bf79cd1788cad0cbf0d926817 (patch) | |
tree | c34c0433dc5b166b17bab1e325942e1ca0610e3e /src/base.cpp | |
parent | a813344b935e4adab163334669df969a586e67d5 (diff) |
Fix implementation of reference to const, use reference counting for ExtensibleItem
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11924 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/base.cpp')
-rw-r--r-- | src/base.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/base.cpp b/src/base.cpp index 2a89a4830..389f3915a 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -47,6 +47,9 @@ refcountbase::refcountbase() : refcount(0) refcountbase::~refcountbase() { + if (refcount && ServerInstance && ServerInstance->Logs) + ServerInstance->Logs->Log("CULLLIST", DEBUG, "refcountbase::~ @%p with refcount %d", + (void*)this, refcount); } ExtensionItem::ExtensionItem(const std::string& Key, Module* mod) : key(Key), owner(mod) @@ -97,12 +100,12 @@ void ExtensionManager::Register(ExtensionItem* item) types.insert(std::make_pair(item->key, item)); } -void ExtensionManager::BeginUnregister(Module* module, std::vector<ExtensionItem*>& list) +void ExtensionManager::BeginUnregister(Module* module, std::vector<reference<ExtensionItem> >& list) { - std::map<std::string, ExtensionItem*>::iterator i = types.begin(); + std::map<std::string, reference<ExtensionItem> >::iterator i = types.begin(); while (i != types.end()) { - std::map<std::string, ExtensionItem*>::iterator me = i++; + std::map<std::string, reference<ExtensionItem> >::iterator me = i++; ExtensionItem* item = me->second; if (item->owner == module) { @@ -114,15 +117,15 @@ void ExtensionManager::BeginUnregister(Module* module, std::vector<ExtensionItem ExtensionItem* ExtensionManager::GetItem(const std::string& name) { - std::map<std::string, ExtensionItem*>::iterator i = types.find(name); + std::map<std::string, reference<ExtensionItem> >::iterator i = types.find(name); if (i == types.end()) return NULL; return i->second; } -void Extensible::doUnhookExtensions(const std::vector<ExtensionItem*>& toRemove) +void Extensible::doUnhookExtensions(const std::vector<reference<ExtensionItem> >& toRemove) { - for(std::vector<ExtensionItem*>::const_iterator i = toRemove.begin(); i != toRemove.end(); ++i) + for(std::vector<reference<ExtensionItem> >::const_iterator i = toRemove.begin(); i != toRemove.end(); ++i) { ExtensionItem* item = *i; ExtensibleStore::iterator e = extensions.find(item); |