23594: EDF 17213 : crash of salome when loading SMESH or dumping the study

Attempt 1:
  in SMESH_Mesh::SortByMeshOrder() assure same size of sortedPos and onlyOrderedList
This commit is contained in:
eap 2018-10-10 17:11:35 +03:00
parent f2614ea1d5
commit a4be05bc3b
3 changed files with 10 additions and 9 deletions

View File

@ -1032,13 +1032,13 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
bool fileOK; bool fileOK;
#ifdef WIN32 #ifdef WIN32
#ifdef UNICODE #ifdef UNICODE
const wchar_t* path = Kernel_Utils::decode_s(xmlPath); const wchar_t* path = Kernel_Utils::decode_s(xmlPath);
#else #else
const char* path = xmlPath.c_str(); const char* path = xmlPath.c_str();
#endif #endif
fileOK = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES); fileOK = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES);
#ifdef UNICODE #ifdef UNICODE
delete path; delete path;
#endif #endif
#else #else
fileOK = (access(xmlPath.c_str(), F_OK) == 0); fileOK = (access(xmlPath.c_str(), F_OK) == 0);

View File

@ -2431,8 +2431,9 @@ bool SMESH_Mesh::SortByMeshOrder(std::vector<SMESH_subMesh*>& theListToSort) con
{ {
TPosInList smPos = find( smBeg, smEnd, smVec[i] ); TPosInList smPos = find( smBeg, smEnd, smVec[i] );
if ( smPos != smEnd ) { if ( smPos != smEnd ) {
onlyOrderedList.push_back( smVec[i] );
sortedPos[ distance( smBeg, smPos )] = smPos; sortedPos[ distance( smBeg, smPos )] = smPos;
if ( sortedPos.size() > onlyOrderedList.size() )
onlyOrderedList.push_back( smVec[i] );
} }
} }
} }

View File

@ -2656,6 +2656,11 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt,
TEPairVec& theNew2OldFaces, TEPairVec& theNew2OldFaces,
TNPairVec& theNew2OldNodes) TNPairVec& theNew2OldNodes)
{ {
if ( theSrcMesh.GetMeshInfo().NbFaces( ORDER_QUADRATIC ) > 0 )
throw SALOME_Exception( "Offset of quadratic mesh not supported" );
if ( theSrcMesh.GetMeshInfo().NbFaces() > theSrcMesh.GetMeshInfo().NbTriangles() )
throw SALOME_Exception( "Offset of non-triangular mesh not supported" );
SMDS_Mesh* newMesh = new SMDS_Mesh; SMDS_Mesh* newMesh = new SMDS_Mesh;
theNew2OldFaces.clear(); theNew2OldFaces.clear();
theNew2OldNodes.clear(); theNew2OldNodes.clear();
@ -2663,11 +2668,6 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt,
( std::make_pair(( const SMDS_MeshElement*) 0, ( std::make_pair(( const SMDS_MeshElement*) 0,
( const SMDS_MeshElement*) 0)); // to have index == face->GetID() ( const SMDS_MeshElement*) 0)); // to have index == face->GetID()
if ( theSrcMesh.GetMeshInfo().NbFaces( ORDER_QUADRATIC ) > 0 )
throw SALOME_Exception( "Offset of quadratic mesh not supported" );
if ( theSrcMesh.GetMeshInfo().NbFaces() > theSrcMesh.GetMeshInfo().NbTriangles() )
throw SALOME_Exception( "Offset of non-triangular mesh not supported" );
// copy input faces to the newMesh keeping IDs of nodes // copy input faces to the newMesh keeping IDs of nodes
double minNodeDist = 1e100; double minNodeDist = 1e100;