21948: EDF SMESH : Memory is not freed when deleting a mesh

-        int                  NewMesh(bool theIsEmbeddedMode);
+        SMESHDS_Mesh *       NewMesh(bool theIsEmbeddedMode, int MeshID);
This commit is contained in:
eap 2012-12-14 13:16:39 +00:00
parent b22f68bd44
commit ee35ac825c
2 changed files with 10 additions and 8 deletions

View File

@ -55,13 +55,15 @@ SMESHDS_Document::~SMESHDS_Document()
//function : NewMesh //function : NewMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
int SMESHDS_Document::NewMesh(bool theIsEmbeddedMode) SMESHDS_Mesh * SMESHDS_Document::NewMesh(bool theIsEmbeddedMode, int MeshID)
{ {
static int aNewMeshID = 0; std::map<int,SMESHDS_Mesh*>::iterator i_m =
aNewMeshID++; myMeshes.insert( make_pair( MeshID, (SMESHDS_Mesh*)0 )).first;
SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(aNewMeshID,theIsEmbeddedMode); if ( i_m->second )
myMeshes[aNewMeshID] = aNewMesh; throw SALOME_Exception("SMESHDS_Document::NewMesh(): ID of existing mesh given");
return aNewMeshID; SMESHDS_Mesh *aNewMesh = new SMESHDS_Mesh(MeshID,theIsEmbeddedMode);
i_m->second = aNewMesh;
return aNewMesh;
} }
//======================================================================= //=======================================================================

View File

@ -38,8 +38,8 @@ class SMESHDS_EXPORT SMESHDS_Document
{ {
public: public:
SMESHDS_Document(int UserID); SMESHDS_Document(int UserID);
~SMESHDS_Document(); ~SMESHDS_Document();
int NewMesh(bool theIsEmbeddedMode); SMESHDS_Mesh * NewMesh(bool theIsEmbeddedMode, int MeshID);
void RemoveMesh(int MeshID); void RemoveMesh(int MeshID);
SMESHDS_Mesh * GetMesh(int MeshID); SMESHDS_Mesh * GetMesh(int MeshID);
void AddHypothesis(SMESHDS_Hypothesis * H); void AddHypothesis(SMESHDS_Hypothesis * H);