summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-19 20:12:12 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-19 20:12:12 +0000
commitaa7cc18468f4b16bf79cd1788cad0cbf0d926817 (patch)
treec34c0433dc5b166b17bab1e325942e1ca0610e3e /src
parenta813344b935e4adab163334669df969a586e67d5 (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')
-rw-r--r--src/base.cpp15
-rw-r--r--src/commands/cmd_info.cpp2
-rw-r--r--src/commands/cmd_modules.cpp2
-rw-r--r--src/modules.cpp2
4 files changed, 12 insertions, 9 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);
diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp
index f239b9f78..2f759837b 100644
--- a/src/commands/cmd_info.cpp
+++ b/src/commands/cmd_info.cpp
@@ -61,7 +61,7 @@ CmdResult CommandInfo::Handle (const std::vector<std::string>&, User *user)
user->WriteNumeric(RPL_INFO, "%s : Thomas Stagner, aquanight, <aquanight@inspircd.org>", user->nick.c_str());
user->WriteNumeric(RPL_INFO, "%s : Uli Schlachter, psychon, <psychon@inspircd.org>", user->nick.c_str());
user->WriteNumeric(RPL_INFO, "%s : Matt Smith, dz, <dz@inspircd.org>", user->nick.c_str());
- user->WriteNumeric(RPL_INFO, "%s : Daniel De Graaf danieldg, <danieldg@inspircd.org>", user->nick.c_str());
+ user->WriteNumeric(RPL_INFO, "%s : Daniel De Graaf, danieldg, <danieldg@inspircd.org>", user->nick.c_str());
user->WriteNumeric(RPL_INFO, "%s : ", user->nick.c_str());
user->WriteNumeric(RPL_INFO, "%s :\2Regular Contributors\2:", user->nick.c_str());
user->WriteNumeric(RPL_INFO, "%s : Majic MacGyver Namegduf Ankit", user->nick.c_str());
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 1b0f1da13..5f7dabdbf 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -52,7 +52,7 @@ CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
if (user->HasPrivPermission("servers/auspex"))
{
- std::string flags("SvscC");
+ std::string flags("SvcC");
int pos = 0;
for (int mult = 1; mult <= VF_OPTCOMMON; mult *= 2, ++pos)
if (!(V.Flags & mult))
diff --git a/src/modules.cpp b/src/modules.cpp
index c5bd87cde..87d25ac42 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -460,7 +460,7 @@ void ModuleManager::DoSafeUnload(Module* mod)
{
std::map<std::string, Module*>::iterator modfind = Modules.find(mod->ModuleSourceFile);
- std::vector<ExtensionItem*> items;
+ std::vector<reference<ExtensionItem> > items;
ServerInstance->Extensions.BeginUnregister(modfind->second, items);
/* Give the module a chance to tidy out all its metadata */
for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); c++)