diff options
author | Adam <Adam@anope.org> | 2016-03-19 16:21:40 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-03-19 16:21:40 -0400 |
commit | 79e7c3f98a57b7cffc46d9a7dc250a0e6e25fc98 (patch) | |
tree | 9bd0e3400b7044c29206a93f4a3b1c58c856a1b1 | |
parent | 72127e1b00cb8a9ca40c566bdc4594a3b17f5228 (diff) |
Also defer channel deletion when processing sjoins
-rw-r--r-- | include/channels.h | 2 | ||||
-rw-r--r-- | src/channels.cpp | 9 | ||||
-rw-r--r-- | src/messages.cpp | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/include/channels.h b/include/channels.h index 99620b7f3..547db9f20 100644 --- a/include/channels.h +++ b/include/channels.h @@ -302,6 +302,8 @@ class CoreExport Channel : public Base, public Extensible */ static Channel *FindOrCreate(const Anope::string &name, bool &created, time_t ts = Anope::CurTime); + void QueueForDeletion(); + static void DeleteChannels(); }; diff --git a/src/channels.cpp b/src/channels.cpp index c2a328b82..3d824f0d8 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -168,8 +168,7 @@ void Channel::DeleteUser(User *user) Log(LOG_DEBUG) << "Channel::DeleteUser() tried to delete non-existent channel " << this->name << " from " << user->nick << "'s channel list"; delete cu; - if (std::find(deleting.begin(), deleting.end(), this) == deleting.end()) - deleting.push_back(this); + QueueForDeletion(); } ChanUserContainer *Channel::FindUser(User *u) const @@ -938,6 +937,12 @@ Channel *Channel::FindOrCreate(const Anope::string &name, bool &created, time_t return chan; } +void Channel::QueueForDeletion() +{ + if (std::find(deleting.begin(), deleting.end(), this) == deleting.end()) + deleting.push_back(this); +} + void Channel::DeleteChannels() { for (unsigned int i = 0; i < deleting.size(); ++i) diff --git a/src/messages.cpp b/src/messages.cpp index 109d6b02f..ee02cc473 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -162,7 +162,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co c->Sync(); if (c->CheckDelete()) - delete c; + c->QueueForDeletion(); } } } |