]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Use custom allocater to decide if refcountbase was allocated on the heap and should...
[user/henk/code/inspircd.git] / src / modules.cpp
index c5bd87cde7676ee94909d9247b57b0da612f0cd6..7e4e0ec6869d67b561df3763eb5162430cd885a0 100644 (file)
@@ -51,12 +51,16 @@ void Event::Send()
 
 // These declarations define the behavours of the base class Module (which does nothing at all)
 
-Module::Module() { }
+Module::Module() : refcount(1) { }
 CullResult Module::cull()
 {
        return classbase::cull();
 }
-Module::~Module() { }
+Module::~Module()
+{
+       if (refcount != 1)
+               ServerInstance->Logs->Log("MODULE", DEFAULT, "References remain to destructed module " + ModuleSourceFile);
+}
 
 ModResult      Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; }
 void           Module::OnUserConnect(User*) { }
@@ -460,7 +464,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++)