From a1b23a72c7266c3906242830f07715d51dce2c0e Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 7 Apr 2005 06:26:17 +0000 Subject: [PATCH] Added duplicate and release to constructors/destructors --- src/SALOMEDS/SALOMEDS_ChildIterator.cxx | 7 ++++++- src/SALOMEDS/SALOMEDS_ChildIterator.hxx | 2 +- src/SALOMEDS/SALOMEDS_SComponentIterator.cxx | 3 ++- src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 3 ++- src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx | 3 ++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx index f493fe376..0acf1e112 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -18,7 +18,12 @@ SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIt { _isLocal = false; _local_impl = NULL; - _corba_impl = theIterator; + _corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator); +} + +SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator() +{ + if(!_isLocal) CORBA::release(_corba_impl); } void SALOMEDS_ChildIterator::Init() diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx index 1507fe847..4bc6298a2 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.hxx @@ -24,7 +24,7 @@ public: SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator); SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator); - ~SALOMEDS_ChildIterator() {}; + ~SALOMEDS_ChildIterator(); virtual void Init(); virtual void InitEx(bool theAllLevels); diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx index 93c2becc0..fd9faf454 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -16,11 +16,12 @@ SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SCom SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(SALOMEDS::SComponentIterator_ptr theIterator) { _isLocal = false; - _corba_impl = theIterator; + _corba_impl = SALOMEDS::SComponentIterator::_duplicate(theIterator); } SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator() { + if(!_isLocal) CORBA::release(_corba_impl); } void SALOMEDS_SComponentIterator::Init() diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index f872d6e7c..1ec301640 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx @@ -23,11 +23,12 @@ SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr th { _isLocal = false; _local_impl = NULL; - _corba_impl = theBuilder; + _corba_impl = SALOMEDS::UseCaseBuilder::_duplicate(theBuilder); } SALOMEDS_UseCaseBuilder::~SALOMEDS_UseCaseBuilder() { + if(!_isLocal) CORBA::release(_corba_impl); } bool SALOMEDS_UseCaseBuilder::Append(SALOMEDSClient_SObject* theObject) diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx index 0d1185097..3ad93e62b 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator.cxx @@ -18,11 +18,12 @@ SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr { _isLocal = false; _local_impl = NULL; - _corba_impl = theIterator; + _corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator); } SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator() { + if(!_isLocal) CORBA::release(_corba_impl); } void SALOMEDS_UseCaseIterator::Init(bool theAllLevels) -- 2.39.2