From 8f50d474d5a2bb42bf5a562005fc9cfa5f1ee153 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 4 Mar 2011 15:18:40 +0000 Subject: [PATCH] SALOME::GenericObj : Destroy() -> UnRegister() --- src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx | 2 +- src/GEOMBase/GEOMBase_Helper.cxx | 8 ++--- src/GEOMBase/GEOM_GenericObjPtr.h | 16 +++++----- src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx | 2 +- src/GEOM_I/GEOM_Gen_i.cc | 32 +++++++++---------- src/GEOM_I_Superv/GEOM_Superv_i.cc | 6 ++-- .../OperationGUI_PartitionDlg.cxx | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index 7f22c4fdd..e514c2a12 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -695,7 +695,7 @@ void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool u GEOM::GEOM_Object_var obj = *it; displayPreview(obj, true, activate, false, lineWidth, displayMode, color); if (toRemoveFromEngine) - obj->Destroy(); + obj->UnRegister(); } HexMeshCheckBox->setChecked(hexMeshState); } catch (const SALOME::SALOME_Exception& e) { diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 079781662..81f411084 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -115,7 +115,7 @@ GEOMBase_Helper::~GEOMBase_Helper() if (myDisplayer) delete myDisplayer; if ( !CORBA::is_nil( myOperation ) ) - myOperation->Destroy(); + myOperation->UnRegister(); } //================================================================ @@ -278,7 +278,7 @@ void GEOMBase_Helper::displayPreview( const bool activate, GEOM::GEOM_Object_var obj=*it; displayPreview( obj, true, activate, false, lineWidth, displayMode, color ); if ( toRemoveFromEngine ) - obj->Destroy(); + obj->UnRegister(); } } } @@ -536,7 +536,7 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN // Each dialog is responsible for this method implementation, // default implementation does nothing restoreSubShapes(aStudyDS, aSO); - aSO->Destroy(); + aSO->UnRegister(); } //================================================================ @@ -845,7 +845,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) // obj has been published in study. Its refcount has been incremented. // It is safe to decrement its refcount // so that it will be destroyed when the entry in study will be removed - obj->Destroy(); + obj->UnRegister(); #endif } else { diff --git a/src/GEOMBase/GEOM_GenericObjPtr.h b/src/GEOMBase/GEOM_GenericObjPtr.h index 61d017970..8dd738e5c 100644 --- a/src/GEOMBase/GEOM_GenericObjPtr.h +++ b/src/GEOMBase/GEOM_GenericObjPtr.h @@ -37,7 +37,7 @@ namespace GEOM This class can be used in conjunction with the references to the CORBA objects which interfaces are inherited from the SALOME::GenericObj CORBA interface. - The smart pointer class automatically invokes Register() / Destroy() functions of th + The smart pointer class automatically invokes Register() / UnRegister() functions of th interface in order to prevent memory leaks and other such problems caused by improper usage of the CORBA references. @@ -89,10 +89,10 @@ namespace GEOM } //! Decrement counter for the object. - void Destroy() + void UnRegister() { if ( !CORBA::is_nil( this->myObject ) ) { - this->myObject->Destroy(); + this->myObject->UnRegister(); this->myObject = TInterface::_nil(); } } @@ -119,13 +119,13 @@ namespace GEOM //! Destroy pointer and remove the reference to the object. ~GenericObjPtr() { - this->Destroy(); + this->UnRegister(); } //! Assign object to reference and remove reference to an old object. GenericObjPtr& operator=( TInterfacePtr theObject ) { - this->Destroy(); + this->UnRegister(); this->myObject = TInterface::_duplicate( theObject ); this->Register(); return *this; @@ -134,7 +134,7 @@ namespace GEOM //! Assign object to reference and remove reference to an old object. GenericObjPtr& operator=( const GenericObjPtr& thePointer ) { - this->Destroy(); + this->UnRegister(); this->myObject = thePointer.myObject; this->Register(); return *this; @@ -184,7 +184,7 @@ namespace GEOM //! Initialize pointer to the given generic object reference and take ownership on it. void take( TInterfacePtr theObject ) { - this->Destroy(); + this->UnRegister(); this->myObject = TInterface::_duplicate( theObject ); } @@ -209,7 +209,7 @@ namespace GEOM //! Nullify pointer. void nullify() { - this->Destroy(); + this->UnRegister(); } }; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx index cf986c23a..09add97a1 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx @@ -160,7 +160,7 @@ GEOMToolsGUI_MarkerDlg::GEOMToolsGUI_MarkerDlg( QWidget* parent ) GEOMToolsGUI_MarkerDlg::~GEOMToolsGUI_MarkerDlg() { - myOperation->Destroy(); + myOperation->UnRegister(); } void GEOMToolsGUI_MarkerDlg::setStandardMarker( GEOM::marker_type type, GEOM::marker_size size ) diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index aeaec2c48..2c869cbff 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -181,11 +181,11 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); aName->SetValue("Geometry"); - aName->Destroy(); + aName->UnRegister(); anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap"); SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr); aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry"); - aPixMap->Destroy(); + aPixMap->UnRegister(); aStudyBuilder->DefineComponentInstance(aFather, (GEOM::GEOM_Gen_var)GEOM_Gen::_this()); } if (aFather->_is_nil()) return aResultSO; @@ -341,7 +341,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, } aResultSO->SetAttrString("AttributeString",aVars.ToCString()); - aFather->Destroy(); + aFather->UnRegister(); //Set a name of the GEOM object aShape->SetName(theName); @@ -616,7 +616,7 @@ CORBA::Boolean GEOM_Gen_i::CanCopy(SALOMEDS::SObject_ptr theObject) { SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var aString=anIOR->Value(); - anIOR->Destroy(); + anIOR->UnRegister(); CORBA::Object_var anObj = _orb->string_to_object(aString); GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow(anObj); // If the object is null one it can't be copied: return false @@ -705,7 +705,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var objStr = _orb->object_to_string(obj); anIOR->SetValue(objStr.in()); - anIOR->Destroy(); + anIOR->UnRegister(); // Return the created in the Study SObject return aNewSO._retn(); @@ -740,7 +740,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR.in()); if(aFatherSO->_is_nil()) return aResultSO._retn(); aResultSO = aStudyBuilder->NewObject(aFatherSO); - aFatherSO->Destroy(); + aFatherSO->UnRegister(); //aStudyBuilder->Addreference(aResultSO, aResultSO); } @@ -760,8 +760,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy, if(aSO->_is_nil()) continue; SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO); aStudyBuilder->Addreference(aSubSO, aSO); - aSO->Destroy(); - aSubSO->Destroy(); + aSO->UnRegister(); + aSubSO->UnRegister(); } return aResultSO._retn(); @@ -793,7 +793,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy, aParts = RestoreSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg, theAddPrefix); - if (!CORBA::is_nil(aSO)) aSO->Destroy(); + if (!CORBA::is_nil(aSO)) aSO->UnRegister(); return aParts._retn(); } @@ -823,7 +823,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesO (SALOMEDS::Study_ptr theS aParts = RestoreGivenSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg, theAddPrefix); - if (!CORBA::is_nil(aSO)) aSO->Destroy(); + if (!CORBA::is_nil(aSO)) aSO->UnRegister(); return aParts._retn(); } @@ -954,7 +954,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, theObject->SetMarkerTexture(aList[0]->GetMarkerTexture()); } - anArgSO->Destroy(); + anArgSO->UnRegister(); } else { // Get interface, containing method, which we will use to reconstruct sub-shapes @@ -1179,7 +1179,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy, } } } // try to build from published parts - anArgSO->Destroy(); + anArgSO->UnRegister(); } } // process arguments } @@ -1545,7 +1545,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr theStu theObject->SetMarkerTexture(aList[0]->GetMarkerTexture()); } - anArgSO->Destroy(); + anArgSO->UnRegister(); } else { // Get interface, containing method, which we will use to reconstruct sub-shapes @@ -1719,7 +1719,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(SALOMEDS::Study_ptr theStu } } } // try to build from published parts - anArgSO->Destroy(); + anArgSO->UnRegister(); } } // process arguments } @@ -2418,12 +2418,12 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry) if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) { SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var aVal = anIOR->Value(); - anIOR->Destroy(); + anIOR->UnRegister(); CORBA::Object_var anObject = aStudy->ConvertIORToObject(aVal); aGeomObject = GEOM::GEOM_Object::_narrow(anObject); } if (!aSObj->_is_nil() ) - aSObj->Destroy(); + aSObj->UnRegister(); const char* aTypeInfo = "Object"; if ( !aGeomObject->_is_nil() ) { diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index c9d551ee5..220a867c3 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -71,11 +71,11 @@ GEOM_Superv_i::~GEOM_Superv_i() { MESSAGE("GEOM_Superv_i::~GEOM_Superv_i"); if (!CORBA::is_nil(myBasicOp)) - myBasicOp->Destroy(); + myBasicOp->UnRegister(); if (!CORBA::is_nil(myBoolOp)) - myBoolOp->Destroy(); + myBoolOp->UnRegister(); if (!CORBA::is_nil(my3DPrimOp)) - my3DPrimOp->Destroy(); + my3DPrimOp->UnRegister(); delete name_service; } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 134db65f2..b51953f18 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -311,7 +311,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() GEOM::ListOfLong_var intList; GEOM::ListOfDouble_var dblList; GEOM::GEOM_IKindOfShape::shape_kind kind = mOp->KindOfShape( myListTools[0].in(), intList.out(), dblList.out() ); - mOp->Destroy(); + mOp->UnRegister(); if ( kind < GEOM::GEOM_IKindOfShape::DISK_CIRCLE || kind > GEOM::GEOM_IKindOfShape::PLANAR ) { myListTools.length( 0 ); return; -- 2.39.2