From 0a821640bb360e7dc8f27bcae4a39404ec0166e5 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 14 Jul 2013 19:30:54 -0400 Subject: Fix deleting seeninfos --- modules/commands/cs_seen.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/commands/cs_seen.cpp') diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index 9c0b6abfb..a739966c8 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -36,6 +36,13 @@ struct SeenInfo : Serializable { } + ~SeenInfo() + { + database_map::iterator iter = database.find(nick); + if (iter != database.end() && iter->second == this) + database.erase(iter); + } + void Serialize(Serialize::Data &data) const anope_override { data["nick"] << nick; @@ -148,7 +155,6 @@ class CommandOSSeen : public Command { Log(LOG_DEBUG) << buf->first << " was last seen " << Anope::strftime(buf->second->last) << ", deleting entry"; delete buf->second; - database.erase(buf); counter++; } } @@ -312,7 +318,6 @@ class CSSeen : public Module { Log(LOG_DEBUG) << cur->first << " was last seen " << Anope::strftime(cur->second->last) << ", purging entries"; delete cur->second; - database.erase(cur); } } Log(LOG_DEBUG) << "cs_seen: Purged database, checked " << previous_size << " nicks and removed " << (previous_size - database.size()) << " old entries."; -- cgit