diff options
Diffstat (limited to 'src/modules.cpp')
-rw-r--r-- | src/modules.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 1194e8358..1d91bb006 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -345,6 +345,11 @@ bool ModuleManager::CanUnload(Module* mod) void ModuleManager::DoSafeUnload(Module* mod) { + // First, notify all modules that a module is about to be unloaded, so in case + // they pass execution to the soon to be unloaded module, it will happen now, + // i.e. before we unregister the services of the module being unloaded + FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(mod)); + std::map<std::string, Module*>::iterator modfind = Modules.find(mod->ModuleSourceFile); std::vector<reference<ExtensionItem> > items; @@ -385,8 +390,6 @@ void ModuleManager::DoSafeUnload(Module* mod) /* Tidy up any dangling resolvers */ ServerInstance->Res->CleanResolvers(mod); - FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(mod)); - DetachAll(mod); Modules.erase(modfind); |