X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/652e6c763d01ad7924087d541928bd44c795d72d..bdeb73fa38787af6728f7d01c0f6c0ae73d38b42:/src/simix/popping_private.h diff --git a/src/simix/popping_private.h b/src/simix/popping_private.h index 934565c128..90ac87f707 100644 --- a/src/simix/popping_private.h +++ b/src/simix/popping_private.h @@ -144,13 +144,17 @@ template inline T* unmarshal_raw(type, u_smx_scalar const& simcall template inline void marshal(type>, u_smx_scalar& simcall, boost::intrusive_ptr value) { - intrusive_ptr_add_ref(&*value); - simcall.dp = static_cast(&*value); + if (value.get() == nullptr) { // Sometimes we return nullptr in an intrusive_ptr... + simcall.dp = nullptr; + } else { + intrusive_ptr_add_ref(&*value); + simcall.dp = static_cast(&*value); + } } template inline boost::intrusive_ptr unmarshal(type>, u_smx_scalar const& simcall) { + // refcount was already increased during the marshaling, thus the "false" as last argument boost::intrusive_ptr res = boost::intrusive_ptr(static_cast(simcall.dp), false); - // intrusive_ptr_release(&*res); return res; } template inline T* unmarshal_raw(type>, u_smx_scalar const& simcall)