mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 07:52:03 +05:00
remove memory leaks uninitalised memory read, etc...
noticed with Rational Purify on Windows
This commit is contained in:
parent
7fbf4225c2
commit
1cc9d0bb1a
@ -220,8 +220,12 @@ char* GEOM_Object::GetName()
|
|||||||
Handle(TDataStd_Name) aNameAttr;
|
Handle(TDataStd_Name) aNameAttr;
|
||||||
if(!_label.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) return NULL;
|
if(!_label.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) return NULL;
|
||||||
|
|
||||||
|
// do not
|
||||||
TCollection_AsciiString aName(aNameAttr->Get());
|
TCollection_AsciiString aName(aNameAttr->Get());
|
||||||
return aName.ToCString();
|
// do not return pointer of local variable
|
||||||
|
// return aName.ToCString();
|
||||||
|
// the following code could lead to memory leak, so take care about recieved pointer
|
||||||
|
return strdup(aName.ToCString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -940,10 +940,10 @@ QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj )
|
|||||||
|
|
||||||
if ( appStudy )
|
if ( appStudy )
|
||||||
{
|
{
|
||||||
string anIOR = SalomeApp_Application::orb()->object_to_string( theObj );
|
CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( theObj );
|
||||||
if ( anIOR != "" )
|
if ( strcmp(anIOR.in(), "") != 0 )
|
||||||
{
|
{
|
||||||
_PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( anIOR ) );
|
_PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( string( anIOR ) ) );
|
||||||
|
|
||||||
_PTR(GenericAttribute) anAttr;
|
_PTR(GenericAttribute) anAttr;
|
||||||
|
|
||||||
|
@ -215,7 +215,8 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object,
|
|||||||
SalomeApp_Study* aDoc = getStudy();
|
SalomeApp_Study* aDoc = getStudy();
|
||||||
if ( aDoc && aDoc->studyDS() ) {
|
if ( aDoc && aDoc->studyDS() ) {
|
||||||
_PTR(Study) aStudy = aDoc->studyDS();
|
_PTR(Study) aStudy = aDoc->studyDS();
|
||||||
_PTR(SObject) aSObj (aStudy->FindObjectIOR(SalomeApp_Application::orb()->object_to_string(object)));
|
CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(object);
|
||||||
|
_PTR(SObject) aSObj (aStudy->FindObjectIOR(string(objStr.in())));
|
||||||
if ( aSObj ) {
|
if ( aSObj ) {
|
||||||
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
|
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
|
||||||
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
|
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
|
||||||
@ -302,7 +303,8 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
|
|||||||
getDisplayer()->SetToActivate( activate );
|
getDisplayer()->SetToActivate( activate );
|
||||||
|
|
||||||
// Make a reference to GEOM_Object
|
// Make a reference to GEOM_Object
|
||||||
getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) );
|
CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string( object );
|
||||||
|
getDisplayer()->SetName( objStr.in() );
|
||||||
|
|
||||||
// Build prs
|
// Build prs
|
||||||
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
|
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
|
||||||
@ -571,11 +573,13 @@ char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const
|
|||||||
{
|
{
|
||||||
SalomeApp_Study* study = getStudy();
|
SalomeApp_Study* study = getStudy();
|
||||||
if ( study ) {
|
if ( study ) {
|
||||||
string IOR = GEOMBase::GetIORFromObject( object);
|
char * objIOR = GEOMBase::GetIORFromObject( object );
|
||||||
|
string IOR( objIOR );
|
||||||
|
free( objIOR );
|
||||||
if ( IOR != "" ) {
|
if ( IOR != "" ) {
|
||||||
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
|
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
|
||||||
if ( SO ) {
|
if ( SO ) {
|
||||||
return TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString();
|
return TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -602,15 +606,15 @@ void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
|
|||||||
if ( CORBA::is_nil( theObj ) )
|
if ( CORBA::is_nil( theObj ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string IOR = SalomeApp_Application::orb()->object_to_string( theObj );
|
CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
|
||||||
TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) );
|
TCollection_AsciiString asciiIOR( (char *)IOR.in() );
|
||||||
GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
|
GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
|
||||||
|
|
||||||
if ( !getStudy() || !getStudy()->studyDS() )
|
if ( !getStudy() || !getStudy()->studyDS() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_PTR(Study) aStudy = getStudy()->studyDS();
|
_PTR(Study) aStudy = getStudy()->studyDS();
|
||||||
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) );
|
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( string( IOR ) ) );
|
||||||
if ( !aSObj )
|
if ( !aSObj )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -174,11 +174,11 @@ static string getEntry( GEOM::GEOM_Object_ptr object )
|
|||||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
||||||
if ( app )
|
if ( app )
|
||||||
{
|
{
|
||||||
string IOR = app->orb()->object_to_string( object );
|
CORBA::String_var IOR = app->orb()->object_to_string( object );
|
||||||
if ( IOR != "" )
|
if ( strcmp(IOR.in(), "") != 0 )
|
||||||
{
|
{
|
||||||
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
|
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
|
||||||
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
|
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( string(IOR) ) );
|
||||||
if ( SO )
|
if ( SO )
|
||||||
return SO->GetID();
|
return SO->GetID();
|
||||||
}
|
}
|
||||||
@ -196,11 +196,11 @@ static string getName( GEOM::GEOM_Object_ptr object )
|
|||||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
||||||
if ( app )
|
if ( app )
|
||||||
{
|
{
|
||||||
string IOR = app->orb()->object_to_string( object );
|
CORBA::String_var IOR = app->orb()->object_to_string( object );
|
||||||
if ( IOR != "" )
|
if ( strcmp(IOR.in(), "") != 0 )
|
||||||
{
|
{
|
||||||
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
|
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
|
||||||
_PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( IOR ) );
|
_PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( string(IOR) ) );
|
||||||
|
|
||||||
_PTR(GenericAttribute) anAttr;
|
_PTR(GenericAttribute) anAttr;
|
||||||
|
|
||||||
|
@ -1610,9 +1610,14 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
|
|||||||
|
|
||||||
QString GeometryGUI::engineIOR() const
|
QString GeometryGUI::engineIOR() const
|
||||||
{
|
{
|
||||||
|
QString anIOR = QString::null;
|
||||||
if ( !CORBA::is_nil( GetGeomGen() ) )
|
if ( !CORBA::is_nil( GetGeomGen() ) )
|
||||||
return QString( getApp()->orb()->object_to_string( GetGeomGen() ) );
|
{
|
||||||
return QString( "" );
|
CORBA::String_var objStr = getApp()->orb()->object_to_string( GetGeomGen() );
|
||||||
|
anIOR = QString( objStr.in() );
|
||||||
|
free( objStr );
|
||||||
|
}
|
||||||
|
return anIOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
LightApp_Selection* GeometryGUI::createSelection() const
|
LightApp_Selection* GeometryGUI::createSelection() const
|
||||||
|
@ -143,7 +143,8 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry)
|
|||||||
if (!father)
|
if (!father)
|
||||||
return;
|
return;
|
||||||
if (!father->ComponentIOR(aFatherIOR)) {
|
if (!father->ComponentIOR(aFatherIOR)) {
|
||||||
aStudyBuilder->LoadWith(father, SalomeApp_Application::orb()->object_to_string(Geom));
|
CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
|
||||||
|
aStudyBuilder->LoadWith(father, objStr.in());
|
||||||
father->ComponentIOR(aFatherIOR);
|
father->ComponentIOR(aFatherIOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,8 +248,8 @@ void GEOMToolsGUI::OnEditDelete()
|
|||||||
// VSR 17/11/04: check if all objects selected belong to GEOM component --> start
|
// VSR 17/11/04: check if all objects selected belong to GEOM component --> start
|
||||||
// modifications of ASV 01.06.05
|
// modifications of ASV 01.06.05
|
||||||
QString parentComp = getParentComponent( aStudy, selected );
|
QString parentComp = getParentComponent( aStudy, selected );
|
||||||
const char* geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
|
CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
|
||||||
QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR ) );
|
QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) );
|
||||||
|
|
||||||
if ( parentComp != geomComp ) {
|
if ( parentComp != geomComp ) {
|
||||||
SUIT_MessageBox::warn1 ( app->desktop(),
|
SUIT_MessageBox::warn1 ( app->desktop(),
|
||||||
|
@ -119,7 +119,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
|
|||||||
GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString());
|
GEOM::GEOM_Object_var obj = GetObject(anObject->GetDocID(), anEntry.ToCString());
|
||||||
|
|
||||||
CORBA::String_var aPersRefString = _orb->object_to_string(obj);
|
CORBA::String_var aPersRefString = _orb->object_to_string(obj);
|
||||||
return strdup(aPersRefString);
|
return strdup(aPersRefString.in());
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -173,8 +173,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
}
|
}
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeIOR");
|
||||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
char *aGeomObjIOR = _orb->object_to_string(theObject);
|
CORBA::String_var aGeomObjIOR = _orb->object_to_string(theObject);
|
||||||
anIOR->SetValue(strdup(aGeomObjIOR));
|
anIOR->SetValue( aGeomObjIOR .in() );
|
||||||
|
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributePixMap");
|
||||||
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
@ -229,7 +229,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
|||||||
aShapeName = "Vertex_";
|
aShapeName = "Vertex_";
|
||||||
}
|
}
|
||||||
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
|
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
|
||||||
//else aShapeName = TCollection_AsciiString(strdup(theName));
|
//else aShapeName = TCollection_AsciiString((char *)theName);
|
||||||
|
|
||||||
// asv : 11.11.04 Introducing a more sofisticated method of name creation, just as
|
// asv : 11.11.04 Introducing a more sofisticated method of name creation, just as
|
||||||
// it is done in GUI in GEOMBase::GetDefaultName() - not just add a Tag() == number
|
// it is done in GUI in GEOMBase::GetDefaultName() - not just add a Tag() == number
|
||||||
@ -339,7 +339,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
|
|||||||
if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
|
if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
|
||||||
|
|
||||||
SALOMEDS::Study_var Study = theComponent->GetStudy();
|
SALOMEDS::Study_var Study = theComponent->GetStudy();
|
||||||
TCollection_AsciiString name( strdup(Study->Name()) );
|
TCollection_AsciiString name( (char *)(Study->Name() ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -457,7 +457,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream,
|
|||||||
// Add IORAttribute to the Study and set IOR of the created GEOM_Object to it
|
// Add IORAttribute to the Study and set IOR of the created GEOM_Object to it
|
||||||
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSO, "AttributeIOR");
|
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aNewSO, "AttributeIOR");
|
||||||
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
anIOR->SetValue(_orb->object_to_string(obj));
|
CORBA::String_var objStr = _orb->object_to_string(obj);
|
||||||
|
anIOR->SetValue(objStr.in());
|
||||||
|
|
||||||
// Return the created in the Study SObject
|
// Return the created in the Study SObject
|
||||||
return aNewSO._retn();
|
return aNewSO._retn();
|
||||||
@ -482,11 +483,11 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
|
|||||||
if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
|
if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
|
||||||
|
|
||||||
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
||||||
char* IOR;
|
CORBA::String_var IOR;
|
||||||
|
|
||||||
if(!theFather->_is_nil()) {
|
if(!theFather->_is_nil()) {
|
||||||
IOR = _orb->object_to_string(theFather);
|
IOR = _orb->object_to_string(theFather);
|
||||||
SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR);
|
SALOMEDS::SObject_var aFatherSO = theStudy->FindObjectIOR(IOR.in());
|
||||||
if(aFatherSO->_is_nil()) return aResultSO._retn();
|
if(aFatherSO->_is_nil()) return aResultSO._retn();
|
||||||
aResultSO = aStudyBuilder->NewObject(aFatherSO);
|
aResultSO = aStudyBuilder->NewObject(aFatherSO);
|
||||||
//aStudyBuilder->Addreference(aResultSO, aResultSO);
|
//aStudyBuilder->Addreference(aResultSO, aResultSO);
|
||||||
@ -504,7 +505,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
|
|||||||
GEOM::GEOM_Object_var anObject = aList[i];
|
GEOM::GEOM_Object_var anObject = aList[i];
|
||||||
if(anObject->_is_nil()) continue;
|
if(anObject->_is_nil()) continue;
|
||||||
IOR = _orb->object_to_string(anObject);
|
IOR = _orb->object_to_string(anObject);
|
||||||
SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(IOR);
|
SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(IOR.in());
|
||||||
if(aSO->_is_nil()) continue;
|
if(aSO->_is_nil()) continue;
|
||||||
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
|
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
|
||||||
aStudyBuilder->Addreference(aSubSO, aSO);
|
aStudyBuilder->Addreference(aSubSO, aSO);
|
||||||
@ -519,8 +520,9 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void GEOM_Gen_i::register_name(char * name)
|
void GEOM_Gen_i::register_name(char * name)
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(_this());
|
CORBA::Object_var obj = _this();
|
||||||
name_service->Register(g, strdup(name));
|
GEOM::GEOM_Gen_var g = GEOM::GEOM_Gen::_narrow(obj);
|
||||||
|
name_service->Register(g, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -862,8 +864,9 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char*
|
|||||||
GEOM_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object);
|
GEOM_Object_i* servant = new GEOM_Object_i (_poa, engine, handle_object);
|
||||||
|
|
||||||
obj = servant->_this();
|
obj = servant->_this();
|
||||||
stringIOR = _orb->object_to_string(obj);
|
CORBA::String_var objStr = _orb->object_to_string(obj);
|
||||||
handle_object->SetIOR(stringIOR);
|
TCollection_AsciiString anAscii( (char *)objStr.in() );
|
||||||
|
handle_object->SetIOR( anAscii );
|
||||||
return obj._retn();
|
return obj._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,16 +38,6 @@
|
|||||||
GEOM_IOperations_i::GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl)
|
GEOM_IOperations_i::GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl)
|
||||||
:SALOME::GenericObj_i( thePOA ), _impl(theImpl), _engine(theEngine)
|
:SALOME::GenericObj_i( thePOA ), _impl(theImpl), _engine(theEngine)
|
||||||
{
|
{
|
||||||
// Win32 porting: the next line is dangerous - GEOM_IOperations_i is an intermediate
|
|
||||||
// base class, therefore <this> is not completely constructed here ->
|
|
||||||
// passing it to activate_object() leads to unpredictable behavior
|
|
||||||
// resulted from memory corruption ( Rational Purify reports ABR errors ).
|
|
||||||
// Moreover, all GEOM_IxxxOperation_i servant classes are activated implicitly
|
|
||||||
// by GEOM_Gen_i::GetxxxOperations() methods.
|
|
||||||
// Therefore, this line is commented.
|
|
||||||
// In case if <thePOA> does not have ImplicitActivation policy, then
|
|
||||||
// activate_object() calls will be necessary in all GEOM_IxxxOperation_i constructors!
|
|
||||||
//thePOA->activate_object(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -52,7 +52,6 @@ GEOM_Object_i::GEOM_Object_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr
|
|||||||
Handle(GEOM_Object) theImpl)
|
Handle(GEOM_Object) theImpl)
|
||||||
: SALOME::GenericObj_i( thePOA ), _engine(theEngine), _impl(theImpl)
|
: SALOME::GenericObj_i( thePOA ), _engine(theEngine), _impl(theImpl)
|
||||||
{
|
{
|
||||||
thePOA->activate_object(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -75,7 +74,8 @@ char* GEOM_Object_i::GetEntry()
|
|||||||
const TDF_Label& aLabel = _impl->GetEntry();
|
const TDF_Label& aLabel = _impl->GetEntry();
|
||||||
TCollection_AsciiString anEntry;
|
TCollection_AsciiString anEntry;
|
||||||
TDF_Tool::Entry(aLabel, anEntry);
|
TDF_Tool::Entry(aLabel, anEntry);
|
||||||
return CORBA::string_dup(anEntry.ToCString());
|
const char* anEntstr = anEntry.ToCString();
|
||||||
|
return CORBA::string_dup(anEntstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -130,7 +130,8 @@ void GEOM_Object_i::SetName(const char* theName)
|
|||||||
char* GEOM_Object_i::GetName()
|
char* GEOM_Object_i::GetName()
|
||||||
{
|
{
|
||||||
char* aName = _impl->GetName();
|
char* aName = _impl->GetName();
|
||||||
if(aName) return strdup(aName);
|
if (aName)
|
||||||
|
return aName; // this is already copy of pointer (see implementation of _impl)
|
||||||
return strdup("");
|
return strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void GEOM_Superv_i::SetStudyID( CORBA::Long theId )
|
|||||||
|
|
||||||
if ( isNewStudy(myLastStudyID,myStudyID) ) {
|
if ( isNewStudy(myLastStudyID,myStudyID) ) {
|
||||||
if (CORBA::is_nil(myGeomEngine)) setGeomEngine();
|
if (CORBA::is_nil(myGeomEngine)) setGeomEngine();
|
||||||
string anEngine = _orb->object_to_string( myGeomEngine );
|
CORBA::String_var anEngine = _orb->object_to_string( myGeomEngine );
|
||||||
|
|
||||||
CORBA::Object_var anObj = name_service->Resolve("/myStudyManager");
|
CORBA::Object_var anObj = name_service->Resolve("/myStudyManager");
|
||||||
if ( !CORBA::is_nil(anObj) ) {
|
if ( !CORBA::is_nil(anObj) ) {
|
||||||
@ -130,7 +130,7 @@ void GEOM_Superv_i::SetStudyID( CORBA::Long theId )
|
|||||||
_PTR(SComponent) aSCO = aDSStudy->FindComponent(myGeomEngine->ComponentDataType());
|
_PTR(SComponent) aSCO = aDSStudy->FindComponent(myGeomEngine->ComponentDataType());
|
||||||
if ( aSCO ) {
|
if ( aSCO ) {
|
||||||
_PTR(StudyBuilder) aBuilder = aDSStudy->NewBuilder();
|
_PTR(StudyBuilder) aBuilder = aDSStudy->NewBuilder();
|
||||||
if ( aBuilder ) aBuilder->LoadWith( aSCO, anEngine );
|
if ( aBuilder ) aBuilder->LoadWith( aSCO, string( anEngine.in() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,8 +606,10 @@ void GroupGUI_GroupDlg::highlightSubShapes()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Standard_Boolean isOk;
|
Standard_Boolean isOk;
|
||||||
|
char* objIOR = GEOMBase::GetIORFromObject( myMainObj );
|
||||||
Handle(GEOM_AISShape) aSh =
|
Handle(GEOM_AISShape) aSh =
|
||||||
GEOMBase::ConvertIORinGEOMAISShape( GEOMBase::GetIORFromObject( myMainObj ), isOk, true );
|
GEOMBase::ConvertIORinGEOMAISShape( objIOR, isOk, true );
|
||||||
|
free( objIOR );
|
||||||
if ( !isOk || aSh.IsNull() )
|
if ( !isOk || aSh.IsNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -703,7 +705,9 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects )
|
|||||||
|
|
||||||
SalomeApp_Study* study = getStudy();
|
SalomeApp_Study* study = getStudy();
|
||||||
if ( study ) {
|
if ( study ) {
|
||||||
string IOR = GEOMBase::GetIORFromObject( aGroup );
|
char* objIOR = GEOMBase::GetIORFromObject( aGroup );
|
||||||
|
string IOR( objIOR );
|
||||||
|
free( objIOR );
|
||||||
if ( IOR != "" ) {
|
if ( IOR != "" ) {
|
||||||
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
|
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
|
||||||
if ( SO ) {
|
if ( SO ) {
|
||||||
|
@ -297,15 +297,15 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
|
|||||||
if ( CORBA::is_nil( theObj ) )
|
if ( CORBA::is_nil( theObj ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
|
CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
|
||||||
TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) );
|
TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) );
|
||||||
myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
|
myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
|
||||||
|
|
||||||
if ( !getStudy() || !( getStudy()->studyDS() ) )
|
if ( !getStudy() || !( getStudy()->studyDS() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_PTR(Study) aStudy = getStudy()->studyDS();
|
_PTR(Study) aStudy = getStudy()->studyDS();
|
||||||
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) );
|
_PTR(SObject) aSObj ( aStudy->FindObjectIOR( string( IOR.in() ) ) );
|
||||||
if ( !aSObj )
|
if ( !aSObj )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user