From: rnv Date: Mon, 6 Oct 2008 08:38:07 +0000 (+0000) Subject: Fix for IPAL20325 (Crash on create presentation for imported field). X-Git-Tag: V4_1_0_maintainance_20081007 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e1e70142e591f40a473af4b9610eaa7fce63eaef;p=modules%2Fvisu.git Fix for IPAL20325 (Crash on create presentation for imported field). --- diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index f8da47ae..cee210c7 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -1194,10 +1194,17 @@ VISU_MEDConvertor vtkIdType aDataType = VTK_DOUBLE; SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField); - if(aFieldDouble->_is_nil()) - aDataType = VTK_LONG; + if(aFieldDouble->_is_nil()) { + if (sizeof(long) == 4 ) // Size of CORBA::Long is always 4 (see CORBA_basetypes.h) + //Fix for IPAL20325 Crash on create presentation for imported field + aDataType = VTK_LONG; + else if (sizeof(int) == 4) + aDataType = VTK_INT; + else { + throw std::runtime_error("Can't map CORBA::Long to a VTK type"); + } + } aField->Init(aMEDField->getNumberOfComponents(), aDataType); - aFieldMap[aFieldName.in()] = aField; if(MYDEBUG)