summaryrefslogtreecommitdiff
path: root/src/serialize.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-06-23 15:44:06 -0400
committerAdam <Adam@anope.org>2014-06-23 15:44:06 -0400
commitff93355af851541e21218811eb46190a3eb070a3 (patch)
treea59f5094c72bc53c34f819e36a17bb8467c48483 /src/serialize.cpp
parent9a947fa4359c667be58ebae4634d9ac0e53d5db4 (diff)
Hold a reference to the type in Serialize::Checker in the event it goes away, and invalidate the type pointer of objects when the type goes away
Diffstat (limited to 'src/serialize.cpp')
-rw-r--r--src/serialize.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/serialize.cpp b/src/serialize.cpp
index 521704df4..570463dc3 100644
--- a/src/serialize.cpp
+++ b/src/serialize.cpp
@@ -124,6 +124,15 @@ Type::Type(const Anope::string &n, unserialize_func f, Module *o) : name(n), un
Type::~Type()
{
+ /* null the type of existing serializable objects of this type */
+ for (std::list<Serializable *>::iterator it = Serializable::SerializableItems->begin(); it != Serializable::SerializableItems->end(); ++it)
+ {
+ Serializable *s = *it;
+
+ if (s->s_type == this)
+ s->s_type = NULL;
+ }
+
std::vector<Anope::string>::iterator it = std::find(TypeOrder.begin(), TypeOrder.end(), this->name);
if (it != TypeOrder.end())
TypeOrder.erase(it);