]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: remove memory leaks
authorcaremoli <caremoli>
Mon, 14 Sep 2009 08:08:36 +0000 (08:08 +0000)
committercaremoli <caremoli>
Mon, 14 Sep 2009 08:08:36 +0000 (08:08 +0000)
src/Container/Component_i.cxx
src/Container/Container_i.cxx

index 83ed0d557629c96e92a7fa8108317b8646ad04c4..6ea4dff99a2c4ae18413468bbea7f6a7cca11d26 100644 (file)
@@ -259,17 +259,18 @@ void Engines_Component_i::ping()
 void Engines_Component_i::destroy()
 {
   MESSAGE("Engines_Component_i::destroy()");
-  //SCRUTE(pd_refCount);
+  //SCRUTE(_refcount_value());
 
   if(_myConnexionToRegistry)delete _myConnexionToRegistry;
   _myConnexionToRegistry = 0 ;
   if(_notifSupplier)delete _notifSupplier;
   _notifSupplier = 0;
+  _poa->deactivate_object(*_id);
   if(_id)
     delete(_id) ;
-  //SCRUTE(pd_refCount);
-  _thisObj->_remove_ref();
-  //SCRUTE(pd_refCount);
+  //SCRUTE(_refcount_value());
+  _remove_ref();
+  //SCRUTE(_refcount_value());
   MESSAGE("Engines_Component_i::destroyed") ;
 }
 
index eaa03a5aded82d14e0fdd97f7aa93dc722e8aab7..e7636281badff05efb2bc10f0a079a32e13c3e36 100644 (file)
@@ -352,11 +352,10 @@ void Engines_Container_i::Shutdown()
           // ignore this entry and continue
         }
     }
+  _listInstances_map.clear();
 
   _NS->Destroy_FullDirectory(_containerName.c_str());
   _NS->Destroy_Name(_containerName.c_str());
-  //_remove_ref();
-  //_poa->deactivate_object(*_id);
   if(_isServantAloneInProcess)
   {
     MESSAGE("Effective Shutdown of container Begins...");
@@ -1157,22 +1156,16 @@ Engines_Container_i::createInstance(std::string genericRegisterName,
     Engines_Component_i *servant =
       dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
     ASSERT(servant);
-    //SCRUTE(servant->pd_refCount);
-    servant->_remove_ref(); // compensate previous id_to_reference 
-    //SCRUTE(servant->pd_refCount);
+    //SCRUTE(servant->_refcount_value());
     _numInstanceMutex.lock() ; // lock to be alone (stl container write)
     _listInstances_map[instanceName] = iobject;
     _cntInstances_map[aGenRegisterName] += 1;
     _numInstanceMutex.unlock() ;
     SCRUTE(aGenRegisterName);
     SCRUTE(_cntInstances_map[aGenRegisterName]);
-    //SCRUTE(servant->pd_refCount);
-#if defined(_DEBUG_) || defined(_DEBUG)
-    bool ret_studyId = servant->setStudyId(studyId);
-    ASSERT(ret_studyId);
-#else
     servant->setStudyId(studyId);
-#endif
+    servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant)
+    //SCRUTE(servant->_refcount_value());
 
     // --- register the engine under the name
     //     containerName(.dir)/instanceName(.object)
@@ -1245,6 +1238,7 @@ void ActSigIntHandler()
 #ifndef WIN32
   struct sigaction SigIntAct ;
   SigIntAct.sa_sigaction = &SigIntHandler ;
+  sigemptyset(&SigIntAct.sa_mask);
   SigIntAct.sa_flags = SA_SIGINFO ;
 #endif