diff options
author | Adam <Adam@anope.org> | 2014-04-07 15:28:07 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-04-07 15:28:07 -0400 |
commit | c1c45a5db9ba52111978f69eea8a6823ee467459 (patch) | |
tree | 919036e38646d02b46322a2f0d862a8e5636c77e | |
parent | a65e95837f1061b689ce8e031010f9d98406bb4d (diff) |
Do not clear all extension items tied to objects when unserializing.
Instead, pass the old object to the unserialization functions and let
them incrementally update the object.
-rw-r--r-- | include/extensible.h | 4 | ||||
-rw-r--r-- | src/extensible.cpp | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/extensible.h b/include/extensible.h index f33312393..2a852ff47 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -176,6 +176,8 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem<T> T t; if (data[this->name] >> t) this->Set(e, t); + else + this->Unset(e); } }; @@ -196,6 +198,8 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool> data[this->name] >> b; if (b) this->Set(e); + else + this->Unset(e); } }; diff --git a/src/extensible.cpp b/src/extensible.cpp index 552ad5d2b..37206f7c1 100644 --- a/src/extensible.cpp +++ b/src/extensible.cpp @@ -49,9 +49,6 @@ void Extensible::ExtensibleSerialize(const Extensible *e, const Serializable *s, void Extensible::ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) { - while (!e->extension_items.empty()) - (*e->extension_items.begin())->Unset(e); - for (std::set<ExtensibleBase *>::iterator it = extensible_items.begin(); it != extensible_items.end(); ++it) { ExtensibleBase *eb = *it; |