]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH/SMESH_Mesh.cxx
Salome HOME
0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
[modules/smesh.git] / src / SMESH / SMESH_Mesh.cxx
index ce4f8fa57ac1fd251be2f547fdbcb5be12256d34..00defb418e0b1ee50b988d70763105285cb8de6e 100644 (file)
@@ -23,7 +23,6 @@
 //  File   : SMESH_Mesh.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
-//  $Header$
 //
 #include "SMESH_Mesh.hxx"
 #include "SMESH_subMesh.hxx"
@@ -110,6 +109,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++) {
@@ -175,6 +179,11 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
                                         (TopAbs_ShapeEnum) ancType,
                                         _mapAncestors );
   }
+  else
+  {
+    _isShapeToMesh = false;
+    _myMeshDS->ShapeToMesh( PseudoShape() );
+  }
 }
 
 //=======================================================================