]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
21948: EDF SMESH : Memory is not freed when deleting a mesh
authoreap <eap@opencascade.com>
Fri, 14 Dec 2012 14:05:32 +0000 (14:05 +0000)
committereap <eap@opencascade.com>
Fri, 14 Dec 2012 14:05:32 +0000 (14:05 +0000)
+  typedef SALOME::GenericObj_wrap< GEOM_Object              > GEOM_Object_wrap;
+  //
+  // wrappers of operations
+  typedef SALOME::GenericObj_wrap< GEOM_IBasicOperations    > GEOM_IBasicOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_ITransformOperations> GEOM_ITransformOperations_wrap;
+  ...

src/GEOMBase/GEOM_GenericObjPtr.h

index b4ece1236a6295b2f3951bee9dd11e4d8e1a661c..f764af96c91621b98a5fda8a1dc90f8a058fa532 100644 (file)
@@ -30,6 +30,8 @@
 #include "SALOMEconfig.h"
 #include CORBA_SERVER_HEADER(GEOM_Gen)
 
+#include <SALOME_GenericObj_wrap.hxx>
+
 namespace GEOM
 {
   /*!
@@ -87,15 +89,15 @@ namespace GEOM
     void Register()
     {
       if ( !CORBA::is_nil( this->myObject ) )
-       this->myObject->Register();
+        this->myObject->Register();
     }
 
     //! Decrement counter for the object.
     void UnRegister()
     {
       if ( !CORBA::is_nil( this->myObject ) ) {
-       this->myObject->UnRegister();
-       this->myObject = TInterface::_nil();
+        this->myObject->UnRegister();
+        this->myObject = TInterface::_nil();
       }
     }
       
@@ -231,6 +233,31 @@ namespace GEOM
   typedef GenericObjPtr<GEOM::GEOM_IAdvancedOperations>  AdvancedOpPtr;
 
   template<> bool GEOMBASE_EXPORT GenericObjPtr<GEOM::GEOM_Object>::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight );
+
+
+  // Declare a type to replace GEOM::GEOM_Object_var by GEOM::GEOM_Object_wrap,
+  // to be used in the case if a new GEOM_Object is received, in which case
+  // obj->UnRegister() must be called to avoid a memory leak.
+  // The GEOM::GEOM_Object_wrap object calls UnRegister() at destruction.
+  // A simple rule: use GEOM::GEOM_Object_wrap if an object is returned by a
+  // GEOM operation (GEOM::GEOM_IBasicOperations etc).
+  //
+  typedef SALOME::GenericObj_wrap< GEOM_Object              > GEOM_Object_wrap;
+  //
+  // wrappers of operations
+  typedef SALOME::GenericObj_wrap< GEOM_IBasicOperations    > GEOM_IBasicOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_ITransformOperations> GEOM_ITransformOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_I3DPrimOperations   > GEOM_I3DPrimOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IShapesOperations   > GEOM_IShapesOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IBlocksOperations   > GEOM_IBlocksOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IBooleanOperations  > GEOM_IBooleanOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_ICurvesOperations   > GEOM_ICurvesOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_ILocalOperations    > GEOM_ILocalOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IHealingOperations  > GEOM_IHealingOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IInsertOperations   > GEOM_IInsertOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IMeasureOperations  > GEOM_IMeasureOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IGroupOperations    > GEOM_IGroupOperations_wrap;
+  typedef SALOME::GenericObj_wrap< GEOM_IAdvancedOperations > GEOM_IAdvancedOperations_wrap;
 }
 
 #endif // GEOM_GenericObjPtr_H