3
0
mirror of https://github.com/triqs/dft_tools synced 2025-01-12 22:18:23 +01:00

arrays : fix in bug in ref counting in deserialize

This commit is contained in:
Olivier Parcollet 2013-09-10 18:44:33 +02:00
parent c06e183ae5
commit 3c2a3c51dc

View File

@ -100,9 +100,15 @@ namespace triqs { namespace arrays { namespace storages {
private:
friend class shared_block<ValueType,!Weak>;
friend class boost::serialization::access;
template<class Archive> void serialize(Archive & ar, const unsigned int version) {
ar & boost::serialization::make_nvp("ptr",sptr); data_ = (sptr ? sptr->p : nullptr); s = (sptr ? sptr->size() : 0);
}
template<class Archive>
void save(Archive & ar, const unsigned int version) const { ar << boost::serialization::make_nvp("ptr",sptr); }
template<class Archive>
void load(Archive & ar, const unsigned int version) {
if (sptr) dec_ref<Weak>(sptr);
ar >> boost::serialization::make_nvp("ptr",sptr); data_ = (sptr ? sptr->p : nullptr); s = (sptr ? sptr->size() : 0);
if (sptr) inc_ref<Weak>(sptr);
}
BOOST_SERIALIZATION_SPLIT_MEMBER();
};
}}}//namespace