diff --git a/triqs/arrays/storages/shared_block.hpp b/triqs/arrays/storages/shared_block.hpp index 48cb2f32..a495979e 100644 --- a/triqs/arrays/storages/shared_block.hpp +++ b/triqs/arrays/storages/shared_block.hpp @@ -100,9 +100,15 @@ namespace triqs { namespace arrays { namespace storages { private: friend class shared_block; friend class boost::serialization::access; - template 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 + void save(Archive & ar, const unsigned int version) const { ar << boost::serialization::make_nvp("ptr",sptr); } + template + void load(Archive & ar, const unsigned int version) { + if (sptr) dec_ref(sptr); + ar >> boost::serialization::make_nvp("ptr",sptr); data_ = (sptr ? sptr->p : nullptr); s = (sptr ? sptr->size() : 0); + if (sptr) inc_ref(sptr); + } + BOOST_SERIALIZATION_SPLIT_MEMBER(); }; }}}//namespace