Don't try and delete from the item list whilst iterating it - make a copy instead

All modules using u_listmode.h are now unloadable (thats 3 more down)


git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5105 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2006-09-02 16:31:59 +00:00
parent 2b96ff2ed9
commit 2208edf6ff

View File

@ -107,7 +107,13 @@ class ListModeBase : public ModeHandler
char moderemove[MAXBUF];
userrec* n = new userrec(ServerInstance);
n->SetFd(FD_MAGIC_NUMBER);
modelist copy;
/* Make a copy of it, because we cant change the list whilst iterating over it */
for(modelist::iterator it = el->begin(); it != el->end(); it++)
{
copy.push_back(*it);
}
for(modelist::iterator it = copy.begin(); it != copy.end(); it++)
{
ServerInstance->Log(DEBUG,"Remove item %s",it->mask.c_str());
sprintf(moderemove,"-%c",this->GetModeChar());