Salome HOME
PAL7962
authorsan <san@opencascade.com>
Wed, 2 Feb 2005 11:09:27 +0000 (11:09 +0000)
committersan <san@opencascade.com>
Wed, 2 Feb 2005 11:09:27 +0000 (11:09 +0000)
src/SMESH_I/SMESH_Group_i.cxx
src/SMESH_I/SMESH_Group_i.hxx
src/SMESH_I/SMESH_Mesh_i.cxx

index 11dbe143b70ec28bce2ebffc32fb9f06eb76f37f..78ca5289810b95a4fb690ab38ca20f4365136ebf 100644 (file)
@@ -46,17 +46,23 @@ SMESH_GroupBase_i::SMESH_GroupBase_i( PortableServer::POA_ptr thePOA, SMESH_Mesh
   myMeshServant( theMeshServant ), 
   myLocalID( theLocalID )
 {
   myMeshServant( theMeshServant ), 
   myLocalID( theLocalID )
 {
-  thePOA->activate_object( this );
+  // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i,
+  // servant activation is performed by SMESH_Mesh_i::createGroup()
+  // thePOA->activate_object( this );
 }
 
 SMESH_Group_i::SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID )
 }
 
 SMESH_Group_i::SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID )
-: SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
+     : SALOME::GenericObj_i( thePOA ),
+       SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
 {
 {
+  MESSAGE("SMESH_Group_i; this = "<<this );
 }
 
 SMESH_GroupOnGeom_i::SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID )
 }
 
 SMESH_GroupOnGeom_i::SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID )
-: SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
+     : SALOME::GenericObj_i( thePOA ),
+       SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
 {
 {
+  MESSAGE("SMESH_GroupOnGeom_i; this = "<<this );
 }
 
 //=============================================================================
 }
 
 //=============================================================================
@@ -67,7 +73,7 @@ SMESH_GroupOnGeom_i::SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_
 
 SMESH_GroupBase_i::~SMESH_GroupBase_i()
 {
 
 SMESH_GroupBase_i::~SMESH_GroupBase_i()
 {
-  MESSAGE("~SMESH_GroupBase_i;" );
+  MESSAGE("~SMESH_GroupBase_i; this = "<<this );
   if ( myMeshServant )
     myMeshServant->removeGroup(myLocalID);
 }
   if ( myMeshServant )
     myMeshServant->removeGroup(myLocalID);
 }
index 7e16691a6df8db23d2ae1013d1839b1ae001fa85..48fb1c036f5627e1b6e51e8a7484636157c65656 100644 (file)
@@ -83,9 +83,8 @@ private:
 // ======
 
 class SMESH_Group_i:
 // ======
 
 class SMESH_Group_i:
-  public SMESH_GroupBase_i,
   public virtual POA_SMESH::SMESH_Group,
   public virtual POA_SMESH::SMESH_Group,
-  public virtual SALOME::GenericObj_i
+  public SMESH_GroupBase_i
 {
  public:
   SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
 {
  public:
   SMESH_Group_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
@@ -101,9 +100,8 @@ class SMESH_Group_i:
 // =========================
 
 class SMESH_GroupOnGeom_i:
 // =========================
 
 class SMESH_GroupOnGeom_i:
-  public SMESH_GroupBase_i,
   public virtual POA_SMESH::SMESH_GroupOnGeom,
   public virtual POA_SMESH::SMESH_GroupOnGeom,
-  public virtual SALOME::GenericObj_i
+  public SMESH_GroupBase_i
 {
  public:
   SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
 {
  public:
   SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID );
index 8197abb31f2a155860c9e8e42892f09d1c01b23f..2f8c2c306efb24cbc88ad8970ad987afc5f6c146 100644 (file)
@@ -881,6 +881,12 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType theElem
       aGroupImpl = new SMESH_GroupOnGeom_i( SMESH_Gen_i::GetPOA(), this, anId );
     else
       aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
       aGroupImpl = new SMESH_GroupOnGeom_i( SMESH_Gen_i::GetPOA(), this, anId );
     else
       aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
+
+    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
+    SMESH_Gen_i::GetPOA()->activate_object( aGroupImpl );
+    aGroupImpl->Register();
+    // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i
+
     aGroup = SMESH::SMESH_GroupBase::_narrow( aGroupImpl->_this() );
     _mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup );
 
     aGroup = SMESH::SMESH_GroupBase::_narrow( aGroupImpl->_this() );
     _mapGroups[anId] = SMESH::SMESH_GroupBase::_duplicate( aGroup );