From e1e70142e591f40a473af4b9610eaa7fce63eaef Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 6 Oct 2008 08:38:07 +0000 Subject: [PATCH] Fix for IPAL20325 (Crash on create presentation for imported field). --- src/VISU_I/VISU_CorbaMedConvertor.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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) -- 2.39.2