diff options
author | Adam <Adam@anope.org> | 2013-07-14 19:30:54 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-14 20:37:42 -0400 |
commit | 0a821640bb360e7dc8f27bcae4a39404ec0166e5 (patch) | |
tree | b875dceae57c3f238b1c9440cf9c7586800911c8 | |
parent | 37733dea6549ee7ff27a1cc04ebc6014b8870016 (diff) |
Fix deleting seeninfos
-rw-r--r-- | modules/commands/cs_seen.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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."; |