summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h2
-rw-r--r--src/channels.cpp9
-rw-r--r--src/messages.cpp2
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();
}
}
}