X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Mesh.cxx;h=5ddf9a5157cf9e6c54f42e9c726dd9325a80da85;hb=b6c9c862b491312d17a4ddec74a9b6c5b96f5c11;hp=866fda73926e79edab0079252b506292f3b302d2;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 866fda739..5ddf9a515 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -85,7 +85,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId, SMESH_Gen* theGen, bool theIsEmbeddedMode, SMESHDS_Document* theDocument): - _groupId( 0 ) + _groupId( 0 ), _nbSubShapes( 0 ) { MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)"); _id = theLocalId; @@ -110,6 +110,11 @@ SMESH_Mesh::~SMESH_Mesh() { INFOS("SMESH_Mesh::~SMESH_Mesh"); + // issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study + // Notify event listeners at least that something happens + if ( SMESH_subMesh * sm = GetSubMeshContaining(1)) + sm->ComputeStateEngine( SMESH_subMesh::MESH_ENTITY_REMOVED ); + // delete groups std::map < int, SMESH_Group * >::iterator itg; for (itg = _mapGroup.begin(); itg != _mapGroup.end(); itg++) { @@ -166,6 +171,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape) { _myMeshDS->ShapeToMesh(aShape); _isShapeToMesh = true; + _nbSubShapes = _myMeshDS->MaxShapeIndex(); // fill _mapAncestors int desType, ancType; @@ -176,6 +182,12 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape) (TopAbs_ShapeEnum) ancType, _mapAncestors ); } + else + { + _isShapeToMesh = false; + _shapeDiagonal = 0.0; + _myMeshDS->ShapeToMesh( PseudoShape() ); + } } //======================================================================= @@ -822,7 +834,7 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) int index = _myMeshDS->ShapeToIndex(aSubShape); // for submeshes on GEOM Group - if ( !index && aSubShape.ShapeType() == TopAbs_COMPOUND ) { + if (( !index || index > _nbSubShapes ) && aSubShape.ShapeType() == TopAbs_COMPOUND ) { TopoDS_Iterator it( aSubShape ); if ( it.More() ) index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );