if (myDisplayer)
delete myDisplayer;
if ( !CORBA::is_nil( myOperation ) )
- myOperation->Destroy();
+ myOperation->UnRegister();
}
//================================================================
GEOM::GEOM_Object_var obj=*it;
displayPreview( obj, true, activate, false, lineWidth, displayMode, color );
if ( toRemoveFromEngine )
- obj->Destroy();
+ obj->UnRegister();
}
}
}
// Each dialog is responsible for this method implementation,
// default implementation does nothing
restoreSubShapes(aStudyDS, aSO);
- aSO->Destroy();
+ aSO->UnRegister();
}
//================================================================
// 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 {
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.
}
//! 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();
}
}
//! 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;
//! 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;
//! 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 );
}
//! Nullify pointer.
void nullify()
{
- this->Destroy();
+ this->UnRegister();
}
};
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;
}
aResultSO->SetAttrString("AttributeString",aVars.ToCString());
- aFather->Destroy();
+ aFather->UnRegister();
//Set a name of the GEOM object
aShape->SetName(theName);
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
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();
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);
}
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();
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();
}
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();
}
theObject->SetMarkerTexture(aList[0]->GetMarkerTexture());
}
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
else {
// Get interface, containing method, which we will use to reconstruct sub-shapes
}
}
} // try to build from published parts
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
} // process arguments
}
theObject->SetMarkerTexture(aList[0]->GetMarkerTexture());
}
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
else {
// Get interface, containing method, which we will use to reconstruct sub-shapes
}
}
} // try to build from published parts
- anArgSO->Destroy();
+ anArgSO->UnRegister();
}
} // process arguments
}
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() ) {