diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-04-05 00:47:26 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-10 19:28:54 +0200 |
commit | 77e8e0bccac5cdd4f3cfcba9ea07e7b4fd80dec2 (patch) | |
tree | d95f76348514e332ec30a77f33e74f532767107d /src | |
parent | 01ea7ce9c34bf85c8d9ec29f58bd82d6536a2162 (diff) |
Run OnUnloadModule hook before starting to unregister services provided by the module
Diffstat (limited to 'src')
-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); |