From c9328ea212652efff9b48aaf2ec65e3575b88283 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 7 Nov 2007 09:28:28 +0000 Subject: [PATCH 1/1] PAL16774 (Crash after display of many groups) implement destructor to free memory at closing a study --- src/SMESHDS/SMESHDS_Document.cxx | 12 ++++++++++++ src/SMESHDS/SMESHDS_Mesh.cxx | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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 4e7561755..18b13fc5d 100644 --- a/src/SMESHDS/SMESHDS_Mesh.cxx +++ b/src/SMESHDS/SMESHDS_Mesh.cxx @@ -1220,13 +1220,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; } - //******************************************************************** //******************************************************************** //******** ********* -- 2.30.2