From c67911bfcc44b8fe010f3a35e966746c30656d55 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Tue, 16 Feb 2021 20:12:16 -0700 Subject: 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. --- src/bots.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/bots.cpp') diff --git a/src/bots.cpp b/src/bots.cpp index 2f6c916a7..94b688f0d 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -62,9 +62,9 @@ BotInfo::~BotInfo() IRCD->SendSQLineDel(&x); } - for (std::set::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end; ++it) + for (std::set::iterator it = this->channels->begin(), it_end = this->channels->end(); it != it_end;) { - ChannelInfo *ci = *it; + ChannelInfo *ci = *it++; this->UnAssign(NULL, ci); } -- cgit