diff options
author | Adam <Adam@anope.org> | 2014-06-23 15:44:06 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-06-23 15:44:06 -0400 |
commit | ff93355af851541e21218811eb46190a3eb070a3 (patch) | |
tree | a59f5094c72bc53c34f819e36a17bb8467c48483 /include/serialize.h | |
parent | 9a947fa4359c667be58ebae4634d9ac0e53d5db4 (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 'include/serialize.h')
-rw-r--r-- | include/serialize.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/serialize.h b/include/serialize.h index 496110fda..f83c9bfd3 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -60,9 +60,9 @@ class CoreExport Serializable : public virtual Base * constructed before other objects are if it isn't. */ static std::list<Serializable *> *SerializableItems; + friend class Serialize::Type; /* The type of item this object is */ Serialize::Type *s_type; - private: /* Iterator into serializable_items */ std::list<Serializable *>::iterator s_iter; /* The hash of the last serialized form of this object commited to the database */ @@ -109,7 +109,7 @@ class CoreExport Serializable : public virtual Base * of class that inherits from Serialiable. Used for unserializing objects * of this type, as it requires a function pointer to a static member function. */ -class CoreExport Serialize::Type +class CoreExport Serialize::Type : public Base { typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &); @@ -188,7 +188,7 @@ class Serialize::Checker { Anope::string name; T obj; - mutable Serialize::Type *type; + mutable ::Reference<Serialize::Type> type; inline void Check() const { |