mirror of
https://github.com/triqs/dft_tools
synced 2025-01-13 06:28:21 +01:00
arrays : fix in bug in ref counting in deserialize
This commit is contained in:
parent
c06e183ae5
commit
3c2a3c51dc
@ -100,9 +100,15 @@ namespace triqs { namespace arrays { namespace storages {
|
|||||||
private:
|
private:
|
||||||
friend class shared_block<ValueType,!Weak>;
|
friend class shared_block<ValueType,!Weak>;
|
||||||
friend class boost::serialization::access;
|
friend class boost::serialization::access;
|
||||||
template<class Archive> void serialize(Archive & ar, const unsigned int version) {
|
template<class Archive>
|
||||||
ar & boost::serialization::make_nvp("ptr",sptr); data_ = (sptr ? sptr->p : nullptr); s = (sptr ? sptr->size() : 0);
|
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
|
}}}//namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user