From da864f46c273a65887831d84e852cf2b20f8a962 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 23 Jul 2013 14:28:34 +0000 Subject: [PATCH] 22261: EDF 2698 SMESH: Memory leak when displaying 2D quadratic elements as arcs Fix leaks of CORBA objects --- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx index 038468386..b022f2e5e 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx @@ -62,7 +62,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject { SALOMEDS::Locker lock; if(!_impl || theObject->_is_nil()) return 0; - return _impl->Append(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + return _impl->Append(_impl->GetSObject( id.in() )); } //============================================================================ @@ -74,7 +75,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject { SALOMEDS::Locker lock; if(!_impl || theObject->_is_nil()) return 0; - return _impl->Remove(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + return _impl->Remove(_impl->GetSObject( id.in() )); } @@ -88,7 +90,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::AppendTo(SALOMEDS::SObject_ptr theFath { SALOMEDS::Locker lock; if(!_impl || theFather->_is_nil() || theObject->_is_nil()) return 0; - return _impl->AppendTo(_impl->GetSObject(theFather->GetID()), _impl->GetSObject(theObject->GetID())); + CORBA::String_var idF = theFather->GetID(); + CORBA::String_var idO = theObject->GetID(); + return _impl->AppendTo(_impl->GetSObject(idF.in()), _impl->GetSObject( idO.in())); } //============================================================================ @@ -101,7 +105,9 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::InsertBefore(SALOMEDS::SObject_ptr the { SALOMEDS::Locker lock; if(!_impl || theFirst->_is_nil() || theNext->_is_nil()) return 0; - return _impl->InsertBefore(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); + CORBA::String_var idF = theFirst->GetID(); + CORBA::String_var idN = theNext->GetID(); + return _impl->InsertBefore(_impl->GetSObject(idF.in()), _impl->GetSObject(idN.in())); } @@ -114,7 +120,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr { SALOMEDS::Locker lock; if(!_impl || theObject->_is_nil()) return 0; - return _impl->SetCurrentObject(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + return _impl->SetCurrentObject(_impl->GetSObject( id.in())); } //============================================================================ @@ -138,7 +145,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theO { SALOMEDS::Locker lock; if(!_impl) return 0; - return _impl->HasChildren(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + return _impl->HasChildren(_impl->GetSObject( id.in())); } //============================================================================ @@ -150,7 +158,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SortChildren(SALOMEDS::SObject_ptr the { SALOMEDS::Locker lock; if(!_impl) return 0; - return _impl->SortChildren(_impl->GetSObject(theObject->GetID()), theAscendingOrder); + CORBA::String_var id = theObject->GetID(); + return _impl->SortChildren(_impl->GetSObject( id.in()), theAscendingOrder); } //============================================================================ @@ -163,7 +172,8 @@ SALOMEDS::SObject_ptr SALOMEDS_UseCaseBuilder_i::GetFather(SALOMEDS::SObject_ptr SALOMEDS::Locker lock; if(!_impl) return NULL; - SALOMEDSImpl_SObject aSO = _impl->GetFather(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetFather(_impl->GetSObject( id.in())); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); return so._retn(); } @@ -177,7 +187,7 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName) { SALOMEDS::Locker lock; if(!_impl) return 0; - return _impl->SetName((char*)theName); + return _impl->SetName(theName); } @@ -217,7 +227,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCase(SALOMEDS::SObject_ptr theObj SALOMEDS::Locker lock; if(!_impl || theObject->_is_nil()) return false; - return _impl->IsUseCase(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + return _impl->IsUseCase(_impl->GetSObject( id.in() )); } //============================================================================ @@ -230,7 +241,8 @@ CORBA::Boolean SALOMEDS_UseCaseBuilder_i::IsUseCaseNode(SALOMEDS::SObject_ptr th SALOMEDS::Locker lock; if(!_impl || theObject->_is_nil()) return false; - return _impl->IsUseCaseNode(_impl->GetSObject(theObject->GetID())); + CORBA::String_var id = theObject->GetID(); + return _impl->IsUseCaseNode(_impl->GetSObject( id.in() )); } //============================================================================ @@ -259,9 +271,12 @@ SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALO if(!_impl) return SALOMEDS::UseCaseIterator::_nil(); SALOMEDSImpl_UseCaseIterator anItr; - if(!CORBA::is_nil(theObject)) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); + if(!CORBA::is_nil(theObject)) { + CORBA::String_var id = theObject->GetID(); + anItr = _impl->GetUseCaseIterator(_impl->GetSObject( id.in())); + } else anItr = _impl->GetUseCaseIterator(SALOMEDSImpl_SObject()); SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb); - SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this()); + SALOMEDS::UseCaseIterator_var anIterator = aServant->_this(); return anIterator._retn(); } -- 2.39.2