From c1a3929ec1a323479f0171e6c8f5ff359ce78c83 Mon Sep 17 00:00:00 2001 From: caremoli Date: Mon, 14 Sep 2009 08:08:36 +0000 Subject: [PATCH] CCAR: remove memory leaks --- src/Container/Component_i.cxx | 9 +++++---- src/Container/Container_i.cxx | 16 +++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 83ed0d557..6ea4dff99 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -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") ; } diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index eaa03a5ad..e7636281b 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -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(_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 -- 2.39.2