diff options
author | Adam <Adam@anope.org> | 2016-03-19 16:21:40 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-10-02 13:44:30 -0400 |
commit | 117b68a47fd9637d71229f943f9e3bf3b14c26d3 (patch) | |
tree | a4a14ef4c06e9c6f15460f576a3f24f32c35a777 | |
parent | 4c5ee25bc68617ce284fcf17cfd7022d561d9210 (diff) |
Also defer channel deletion when processing sjoins
(cherry picked from commit 79e7c3f98a57b7cffc46d9a7dc250a0e6e25fc98)
-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 5888f84e3..664f06a0a 100644 --- a/include/channels.h +++ b/include/channels.h @@ -313,6 +313,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 3072e1fac..98ecfe127 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -169,8 +169,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 @@ -925,6 +924,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 89ae65932..c778de383 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -174,7 +174,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co c->Sync(); if (c->CheckDelete()) - delete c; + c->QueueForDeletion(); } } } |