From 833b54fac9134b6c7eb2ba273f71b6e1cf72e59d Mon Sep 17 00:00:00 2001 From: caremoli Date: Mon, 14 Sep 2009 08:45:03 +0000 Subject: [PATCH 1/1] CCAR: remove memory leaks in non local SALOMEDS --- src/SALOMEDS/SALOMEDS_AttributeIOR.cxx | 4 +-- src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx | 3 ++ src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeName.cxx | 4 +-- src/SALOMEDS/SALOMEDS_AttributePixMap.cxx | 6 ++-- .../SALOMEDS_AttributeStudyProperties.cxx | 28 +++++++++---------- 6 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx index 121d87587..f82fbf353 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx @@ -46,7 +46,7 @@ std::string SALOMEDS_AttributeIOR::Value() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->Value(); } - else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->Value(); return aValue; } @@ -57,5 +57,5 @@ void SALOMEDS_AttributeIOR::SetValue(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetValue(value); } - else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str()); + else ((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index 79aee1e5b..4a74580ec 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -77,3 +77,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) string anExtStr((char *)Str.in()); dynamic_cast(_impl)->SetValue(anExtStr); } + +SALOMEDS_AttributeIOR_i::~SALOMEDS_AttributeIOR_i() +{} diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx index c5f05dcb7..a1c415c3d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx @@ -39,7 +39,7 @@ public: SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; - ~SALOMEDS_AttributeIOR_i() {}; + ~SALOMEDS_AttributeIOR_i(); char* Value(); void SetValue(const char* value); diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.cxx b/src/SALOMEDS/SALOMEDS_AttributeName.cxx index 86a384ddd..4fac58cbb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.cxx @@ -46,7 +46,7 @@ std::string SALOMEDS_AttributeName::Value() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->Value(); } - else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->Value(); return aValue; } @@ -57,5 +57,5 @@ void SALOMEDS_AttributeName::SetValue(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetValue(value); } - else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str()); + else ((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx index c7cd068cc..d18ed86b3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx @@ -46,7 +46,7 @@ bool SALOMEDS_AttributePixMap::HasPixMap() SALOMEDS::Locker lock; ret = dynamic_cast(_local_impl)->HasPixMap(); } - else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap(); + else ret = ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->HasPixMap(); return ret; } @@ -57,7 +57,7 @@ std::string SALOMEDS_AttributePixMap::GetPixMap() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->GetPixMap(); } - else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->GetPixMap(); return aValue; } @@ -68,5 +68,5 @@ void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetPixMap(value); } - else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str()); + else ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->SetPixMap(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index d8eacff0a..111ea32c7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -51,7 +51,7 @@ void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName) dynamic_cast(_local_impl); anImpl->ChangeCreatorName(theName); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUserName(theName.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetUserName() @@ -62,9 +62,9 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() aName = dynamic_cast(_local_impl)->GetCreatorName(); } #ifndef WIN32 - else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); + else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserName(); #else - else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA(); + else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserNameA(); #endif return aName; } @@ -82,7 +82,7 @@ void SALOMEDS_AttributeStudyProperties::SetCreationDate string S; anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } else { - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationDate(theMinute, theHour, theDay, theMonth, @@ -103,7 +103,7 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear); } else { CORBA::Long aMinute, anHour, aDay, aMonth, anYear; - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute, + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationDate(aMinute, anHour, aDay, aMonth, @@ -129,7 +129,7 @@ void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMo else //Not defined dynamic_cast(_local_impl)->SetCreationMode(0); } - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str()); + else ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationMode(theMode.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() @@ -142,7 +142,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() if (mode == 2) aMode = "copy from"; } else - aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode(); + aMode = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationMode(); return aMode; } @@ -153,7 +153,7 @@ void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) dynamic_cast(_local_impl)->SetModified(theModified); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModified(theModified); } bool SALOMEDS_AttributeStudyProperties::IsModified() @@ -164,7 +164,7 @@ bool SALOMEDS_AttributeStudyProperties::IsModified() ret = dynamic_cast(_local_impl)->IsModified(); } else - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsModified(); return ret; } @@ -176,7 +176,7 @@ int SALOMEDS_AttributeStudyProperties::GetModified() isModified = dynamic_cast(_local_impl)->GetModified(); } else - isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); + isModified = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModified(); return isModified; } @@ -187,7 +187,7 @@ void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) dynamic_cast(_local_impl)->SetLocked(theLocked); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetLocked(theLocked); } bool SALOMEDS_AttributeStudyProperties::IsLocked() @@ -198,7 +198,7 @@ bool SALOMEDS_AttributeStudyProperties::IsLocked() ret = dynamic_cast(_local_impl)->IsLocked(); } else - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsLocked(); return ret; } @@ -215,7 +215,7 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast(_local_impl); anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(), + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModification(theName.c_str(), theMinute, theHour, theDay, @@ -252,7 +252,7 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vectorGetModificationsList(aNames.out(), + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModificationsList(aNames.out(), aMinutes.out(), aHours.out(), aDays.out(), -- 2.30.2