]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Unregister modes before unhooking extensions when unloading a module
authorAttila Molnar <attilamolnar@hush.com>
Mon, 29 Aug 2016 12:34:19 +0000 (14:34 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Mon, 29 Aug 2016 12:34:19 +0000 (14:34 +0200)
Listmodes store their list in an extension that must be present when they are unset to show the modes being unset

src/modules.cpp

index 567aa917cdb9aab8140c8c3948325c2e4d48c36d..5c5e5c5c03c9c67e371a6a49954d05ed1d06ec8f 100644 (file)
@@ -363,6 +363,10 @@ void ModuleManager::DoSafeUnload(Module* mod)
 
        std::map<std::string, Module*>::iterator modfind = Modules.find(mod->ModuleSourceFile);
 
+       // Unregister modes before extensions because modes may require their extension to show the mode being unset
+       UnregisterModes(mod, MODETYPE_USER);
+       UnregisterModes(mod, MODETYPE_CHANNEL);
+
        std::vector<reference<ExtensionItem> > items;
        ServerInstance->Extensions.BeginUnregister(modfind->second, items);
        /* Give the module a chance to tidy out all its metadata */
@@ -388,9 +392,6 @@ void ModuleManager::DoSafeUnload(Module* mod)
                user->doUnhookExtensions(items);
        }
 
-       UnregisterModes(mod, MODETYPE_USER);
-       UnregisterModes(mod, MODETYPE_CHANNEL);
-
        for(std::multimap<std::string, ServiceProvider*>::iterator i = DataProviders.begin(); i != DataProviders.end(); )
        {
                std::multimap<std::string, ServiceProvider*>::iterator curr = i++;