X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCalculator%2FMEDCalculatorBrowserField.cxx;h=e26b1d35909e3a5094cf2116abf3e3634f8b949e;hb=662f5f9943e52f66cdaacee65ccbd145c4c656ce;hp=9e8b3aec2931d3ebc8b1277bc4f9ee8536a7ab60;hpb=9143e3cf1d22d4d867717fa44d39e7d816a46979;p=modules%2Fmed.git diff --git a/src/MEDCalculator/MEDCalculatorBrowserField.cxx b/src/MEDCalculator/MEDCalculatorBrowserField.cxx index 9e8b3aec2..e26b1d359 100644 --- a/src/MEDCalculator/MEDCalculatorBrowserField.cxx +++ b/src/MEDCalculator/MEDCalculatorBrowserField.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -58,17 +58,21 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch } std::vector types=GetTypesOfField(fname,meshNames[0].c_str(),fieldName); 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..."); + throw INTERP_KERNEL::Exception("MEDCalculatorBrowserField::MEDCalculatorBrowserField : the file is not loadable using MED File 3 API ! Probably 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); + MCAuto tmpf2(ReadField(_type,fname,meshNames[0].c_str(),0,fieldName,dtits[0].first.first,dtits[0].first.second)); + tmpf=DynamicCast(tmpf2); } catch(INTERP_KERNEL::Exception& e) { if(_type==ON_CELLS) - tmpf=ReadField(_type,fname,meshNames[0].c_str(),-1,fieldName,dtits[0].first.first,dtits[0].first.second); + { + MCAuto tmpf2(ReadField(_type,fname,meshNames[0].c_str(),-1,fieldName,dtits[0].first.first,dtits[0].first.second)); + tmpf=DynamicCast(tmpf2); + } else throw e; } @@ -80,7 +84,6 @@ MEDCalculatorBrowserField::MEDCalculatorBrowserField(const char *fname, const ch c="-noname-"; _components.push_back(c); } - tmpf->decrRef(); _corresponding_meshes=GetMeshNamesOnField(fname,fieldName); }