SALOME::GenericObj : Destroy() -> UnRegister()

This commit is contained in:
vsr 2011-03-04 15:18:40 +00:00
parent 33b02426f0
commit 8f50d474d5
7 changed files with 34 additions and 34 deletions

View File

@ -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) {

View File

@ -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 {

View File

@ -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();
}
};

View File

@ -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 )

View File

@ -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() ) {

View File

@ -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;
}

View File

@ -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;