summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-02 16:31:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-02 16:31:59 +0000
commit2208edf6ff4e97a1f95a43bd96a58b548fbc6100 (patch)
tree85f5e6520d3580bf095d44c66fb543713cdd9d9f
parent2b96ff2ed97cc2646b2790aa6a424caf073070c2 (diff)
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
-rw-r--r--include/u_listmode.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/u_listmode.h b/include/u_listmode.h
index bc6a9fa20..b733d7536 100644
--- a/include/u_listmode.h
+++ b/include/u_listmode.h
@@ -107,8 +107,14 @@ 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());
const char* parameters[] = { channel->name, moderemove, it->mask.c_str() };