From: Anthony Geay Date: Thu, 9 Mar 2017 09:31:43 +0000 (+0100) Subject: Update C++ code consecutive to API modification of ReadField X-Git-Tag: SHAPER_2.7.0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=90a2fe2ea9a5b7187ecc48b95fa80eb22fc40788;p=modules%2Fmed.git Update C++ code consecutive to API modification of ReadField --- diff --git a/src/MEDCalc/cmp/MEDDataManager_i.cxx b/src/MEDCalc/cmp/MEDDataManager_i.cxx index a3f937175..b3ef30545 100644 --- a/src/MEDCalc/cmp/MEDDataManager_i.cxx +++ b/src/MEDCalc/cmp/MEDDataManager_i.cxx @@ -641,7 +641,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDCALC::FieldHa LOG("getFieldDouble: field "<fieldname<<" loaded from file "<type; int meshDimRelToMax = 0; - MEDCouplingFieldDouble * myField = ReadField(type, + MCAuto myField = ReadField(type, filepath, meshName, meshDimRelToMax, @@ -649,7 +649,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDCALC::FieldHa fieldHandler->iteration, fieldHandler->order); myField->setMesh(myMesh); - _fieldDoubleMap[fieldHandler->id] = myField; + _fieldDoubleMap[fieldHandler->id] = myField.retn(); return myField; } diff --git a/src/MEDCalculator/MEDCalculatorBrowserField.cxx b/src/MEDCalculator/MEDCalculatorBrowserField.cxx index 6609186a4..ff8a351d0 100644 --- a/src/MEDCalculator/MEDCalculatorBrowserField.cxx +++ b/src/MEDCalculator/MEDCalculatorBrowserField.cxx @@ -60,7 +60,7 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch if(types.empty()) throw INTERP_KERNEL::Exception("MEDCalculatorBrowserField::MEDCalculatorBrowserField : the file is not loadable using MED File 3 API ! Problably presence of field on edges faces..."); _type=types[0];//To improve - MEDCouplingFieldDouble *tmpf=0; + MCAuto tmpf; try { tmpf=ReadField(_type,fname,meshNames[0].c_str(),0,fieldName,dtits[0].first.first,dtits[0].first.second); @@ -80,7 +80,6 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch c="-noname-"; _components.push_back(c); } - tmpf->decrRef(); _corresponding_meshes=GetMeshNamesOnField(fname,fieldName); } diff --git a/src/MEDCalculator/MEDCalculatorDBSliceField.cxx b/src/MEDCalculator/MEDCalculatorDBSliceField.cxx index 0a0327a76..e2d6e6631 100644 --- a/src/MEDCalculator/MEDCalculatorDBSliceField.cxx +++ b/src/MEDCalculator/MEDCalculatorDBSliceField.cxx @@ -95,7 +95,10 @@ MEDCalculatorDBSliceField::~MEDCalculatorDBSliceField() MEDCouplingFieldDouble *MEDCalculatorDBSliceField::getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const { if(!_field) - _field=ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order); + { + MCAuto tmp(ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order)); + _field=tmp.retn(); + } return _field; }