summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-03-15 15:42:30 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-03-15 15:42:30 +0100
commit6fbfdcc3f3d20ca978246cd2c051c7f05601d055 (patch)
tree4dafb71b2faf4d74f2af5b72ab7201310c7cbccf /src
parent0babd8c0783242fc647cdcdfefb399c099e367ad (diff)
Fix invalid iterator use when removing modes in ModuleManager::DoSafeUnload()
Diffstat (limited to 'src')
-rw-r--r--src/modules.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index b6d18b8fd..a4b5ae4bc 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -413,17 +413,19 @@ void ModuleManager::DoSafeUnload(Module* mod)
}
const ModeParser::ModeHandlerMap& usermodes = ServerInstance->Modes->GetModes(MODETYPE_USER);
- for (ModeParser::ModeHandlerMap::const_iterator i = usermodes.begin(); i != usermodes.end(); ++i)
+ for (ModeParser::ModeHandlerMap::const_iterator i = usermodes.begin(); i != usermodes.end(); )
{
ModeHandler* mh = i->second;
+ ++i;
if (mh->creator == mod)
this->DelService(*mh);
}
const ModeParser::ModeHandlerMap& chanmodes = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL);
- for (ModeParser::ModeHandlerMap::const_iterator i = chanmodes.begin(); i != chanmodes.end(); ++i)
+ for (ModeParser::ModeHandlerMap::const_iterator i = chanmodes.begin(); i != chanmodes.end(); )
{
ModeHandler* mh = i->second;
+ ++i;
if (mh->creator == mod)
this->DelService(*mh);
}