1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 13:36:38 +02:00

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

This commit is contained in:
Adam
2014-06-23 15:44:06 -04:00
parent 9a947fa435
commit ff93355af8
2 changed files with 12 additions and 3 deletions
+9
View File
@@ -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);