diff options
| author | 2014-01-21 18:44:08 +0100 | |
|---|---|---|
| committer | 2014-01-21 18:44:08 +0100 | |
| commit | e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804 (patch) | |
| tree | 5a69b0efe6c0b7ab88925d3d066271ec40845e23 /src/modules.cpp | |
| parent | m_spanningtree Fix routing of ROUTE_TYPE_MESSAGE messages (diff) | |
| parent | Release 2.0.15 (diff) | |
| download | inspircd++-e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804.tar.gz inspircd++-e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804.tar.bz2 inspircd++-e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804.zip | |
Merge insp20
Diffstat (limited to 'src/modules.cpp')
| -rw-r--r-- | src/modules.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 5c5e4febc..23aceb3e1 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -388,18 +388,23 @@ void ModuleManager::DoSafeUnload(Module* mod) 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++) + for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); ) { - mod->OnCleanup(TYPE_CHANNEL,c->second); - c->second->doUnhookExtensions(items); - const UserMembList* users = c->second->GetUsers(); + Channel* chan = c->second; + ++c; + mod->OnCleanup(TYPE_CHANNEL, chan); + chan->doUnhookExtensions(items); + const UserMembList* users = chan->GetUsers(); for(UserMembCIter mi = users->begin(); mi != users->end(); mi++) mi->second->doUnhookExtensions(items); } - for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++) + for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); ) { - mod->OnCleanup(TYPE_USER,u->second); - u->second->doUnhookExtensions(items); + User* user = u->second; + // The module may quit the user (e.g. SSL mod unloading) and that will remove it from the container + ++u; + mod->OnCleanup(TYPE_USER, user); + user->doUnhookExtensions(items); } for(char m='A'; m <= 'z'; m++) { |
