1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 05:36:37 +02:00

bots: Fix dtor channel iterator being invalidated.

The call to UnAssign() erases the channel from the set which
invalidates the iterator in this loop. Handle this in the same
manner as the NickCore dtor.
This commit is contained in:
Matt Schatz
2021-02-16 20:12:16 -07:00
committed by Sadie Powell
parent 4d271e0210
commit c67911bfcc
+2 -2
View File
@@ -62,9 +62,9 @@ BotInfo::~BotInfo()
IRCD->SendSQLineDel(&x);
}
for (std::set<ChannelInfo *>::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end; ++it)
for (std::set<ChannelInfo *>::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end;)
{
ChannelInfo *ci = *it;
ChannelInfo *ci = *it++;
this->UnAssign(NULL, ci);
}