From 30610582c750b4c62f2ae74d1396c1e5d1a5d7bc Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 16 Jan 2015 10:58:28 +0100 Subject: Gracefully handle multiple Channel::CheckDestroy() calls on the same object Don't add the channel to the cull list more than once --- src/channels.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index fdf0f76e1..02a6ae30b 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -86,14 +86,13 @@ void Channel::CheckDestroy() if (res == MOD_RES_DENY) return; + // If the channel isn't in chanlist then it is already in the cull list, don't add it again chan_hash::iterator iter = ServerInstance->chanlist.find(this->name); - /* kill the record */ - if (iter != ServerInstance->chanlist.end()) - { - FOREACH_MOD(OnChannelDelete, (this)); - ServerInstance->chanlist.erase(iter); - } + if (iter == ServerInstance->chanlist.end()) + return; + FOREACH_MOD(OnChannelDelete, (this)); + ServerInstance->chanlist.erase(iter); ClearInvites(); ServerInstance->GlobalCulls.AddItem(this); } -- cgit v1.3.1-10-gc9f91