X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/153846bd56973cd7cd434fc0a5cf24f3508410ba..d2958d5c9a0fdca7d0fa344382c13cbcfc581597:/src/smpi/mpi/smpi_datatype.cpp?ds=sidebyside diff --git a/src/smpi/mpi/smpi_datatype.cpp b/src/smpi/mpi/smpi_datatype.cpp index 561499f0b1..22a28a3759 100644 --- a/src/smpi/mpi/smpi_datatype.cpp +++ b/src/smpi/mpi/smpi_datatype.cpp @@ -136,9 +136,10 @@ Datatype::Datatype(const char* name, int ident, int size, MPI_Aint lb, MPI_Aint } Datatype::Datatype(Datatype* datatype, int* ret) - : size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_) + : size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), duplicated_datatype_(datatype) { this->add_f(); + datatype->ref(); *ret = this->copy_attrs(datatype); } @@ -150,6 +151,8 @@ Datatype::~Datatype() return; //prevent further usage flags_ &= ~ DT_FLAG_COMMITED; + if(duplicated_datatype_ != MPI_DATATYPE_NULL) + unref(duplicated_datatype_); F2C::free_f(this->f2c_id()); //if still used, mark for deletion if(refcount_!=0){