Salome HOME
PAL16774 (Crash after display of many groups)
authoreap <eap@opencascade.com>
Wed, 3 Oct 2007 14:44:12 +0000 (14:44 +0000)
committereap <eap@opencascade.com>
Wed, 3 Oct 2007 14:44:12 +0000 (14:44 +0000)
    implement destructor

src/SMESHDS/SMESHDS_Document.cxx
src/SMESHDS/SMESHDS_Mesh.cxx

index 87fb9a0d43a28402c8848af156bd6fc086befb9a..815474d55a8331d67b4823b2327042ac805e2cc5 100644 (file)
@@ -39,6 +39,18 @@ SMESHDS_Document::SMESHDS_Document(int UserID):myUserID(UserID)
 {
 }
 
+//=======================================================================
+//function : Destructor
+//purpose  : 
+//=======================================================================
+
+SMESHDS_Document::~SMESHDS_Document()
+{
+  InitMeshesIterator();
+  while ( MoreMesh() )
+    delete NextMesh();
+}
+
 //=======================================================================
 //function : NewMesh
 //purpose  : 
index 6a82e05c519c5b7270fb164edbc809b0ec4ca954..718a16baf6fb12c063cd8fe24de237ec50651da5 100644 (file)
@@ -1126,7 +1126,7 @@ int SMESHDS_Mesh::AddCompoundSubmesh(const TopoDS_Shape& S,
 //=======================================================================
 const TopoDS_Shape& SMESHDS_Mesh::IndexToShape(int ShapeIndex) const
 {
-       return myIndexToShape.FindKey(ShapeIndex);
+  return myIndexToShape.FindKey(ShapeIndex);
 }
 
 //=======================================================================
@@ -1198,13 +1198,21 @@ void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
   add( anElement, getSubmesh( Index ));
 }
 
+//=======================================================================
+//function : ~SMESHDS_Mesh
+//purpose  : 
+//=======================================================================
 SMESHDS_Mesh::~SMESHDS_Mesh()
 {
+  // myScript
   delete myScript;
+  // submeshes
+  TShapeIndexToSubMesh::iterator i_sm = myShapeIndexToSubMesh.begin();
+  for ( ; i_sm != myShapeIndexToSubMesh.end(); ++i_sm )
+    delete i_sm->second;
 }
 
 
-
 //********************************************************************
 //********************************************************************
 //********                                                   *********