]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH_I/SMESH_Filter_i.cxx
Salome HOME
21948: EDF SMESH : Memory is not freed when deleting a mesh
[modules/smesh.git] / src / SMESH_I / SMESH_Filter_i.cxx
index fc5314b8cbf339ae8721f9bd3ab80bd492256889..523bf46770efc3b13e4f8987e3f0f9ef54c22605 100644 (file)
 //
 #include "SMESH_Filter_i.hxx"
 
-#include "SMESH_Gen_i.hxx"
-#include "SMESH_PythonDump.hxx"
-
+#include "SMDS_ElemIterator.hxx"
 #include "SMDS_Mesh.hxx"
-#include "SMDS_MeshNode.hxx"
 #include "SMDS_MeshElement.hxx"
-#include "SMDS_ElemIterator.hxx"
-
+#include "SMDS_MeshNode.hxx"
 #include "SMESHDS_Mesh.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include <SALOMEDS_wrap.hxx>
 
 #include <BRep_Tool.hxx>
 #include <Geom_CylindricalSurface.hxx>
@@ -496,7 +496,9 @@ static TopoDS_Shape getShapeByName( const char* theName )
       {
         CORBA::Object_var        anObj = aList[ 0 ]->GetObject();
         GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( anObj );
-        return aSMESHGen->GeomObjectToShape( aGeomObj );
+        TopoDS_Shape             shape = aSMESHGen->GeomObjectToShape( aGeomObj );
+        SALOME::UnRegister( aList ); // UnRegister() objects in aList
+        return shape;
       }
     }
   }
@@ -509,7 +511,7 @@ static TopoDS_Shape getShapeByID (const char* theID)
     SMESH_Gen_i*     aSMESHGen = SMESH_Gen_i::GetSMESHGen();
     SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
     if ( !aStudy->_is_nil() ) {
-      SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID);
+      SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
       if ( !aSObj->_is_nil() ) {
         CORBA::Object_var          obj = aSObj->GetObject();
         GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(obj);
@@ -526,7 +528,7 @@ static std::string getShapeNameByID (const char* theID)
     SMESH_Gen_i*     aSMESHGen = SMESH_Gen_i::GetSMESHGen();
     SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
     if ( !aStudy->_is_nil() ) {
-      SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theID);
+      SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
       if ( !aSObj->_is_nil() ) {
         CORBA::String_var name = aSObj->GetName();
         return name.in();