From: eap Date: Wed, 3 Oct 2007 14:44:12 +0000 (+0000) Subject: PAL16774 (Crash after display of many groups) X-Git-Tag: V3_2_8~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a4bc42abfcecf202cef69862a8fdf2afb18aa71b;p=modules%2Fsmesh.git PAL16774 (Crash after display of many groups) implement destructor --- diff --git a/src/SMESHDS/SMESHDS_Document.cxx b/src/SMESHDS/SMESHDS_Document.cxx index 87fb9a0d4..815474d55 100644 --- a/src/SMESHDS/SMESHDS_Document.cxx +++ b/src/SMESHDS/SMESHDS_Document.cxx @@ -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 : diff --git a/src/SMESHDS/SMESHDS_Mesh.cxx b/src/SMESHDS/SMESHDS_Mesh.cxx index 6a82e05c5..718a16baf 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -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; } - //******************************************************************** //******************************************************************** //******** *********