mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-13 17:18:35 +05:00
Correction to avoid memory leaks (links to 0021708: [CEA 586]).
This commit is contained in:
parent
3d0eb30949
commit
7a89c82974
@ -262,7 +262,7 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
|
|||||||
SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
|
SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
|
||||||
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
|
||||||
SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
|
SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
|
||||||
SALOMEDS::SObject_var objAfter;
|
SALOMEDS::SObject_wrap objAfter;
|
||||||
if ( SO->_is_nil() ) {
|
if ( SO->_is_nil() ) {
|
||||||
if ( theTag == 0 ) {
|
if ( theTag == 0 ) {
|
||||||
SO = aStudyBuilder->NewObject( theFatherObject );
|
SO = aStudyBuilder->NewObject( theFatherObject );
|
||||||
@ -273,15 +273,19 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
|
|||||||
std::string anEntry;
|
std::string anEntry;
|
||||||
int last2Pnt_pos = -1;
|
int last2Pnt_pos = -1;
|
||||||
int tagAfter = -1;
|
int tagAfter = -1;
|
||||||
|
CORBA::String_var entry;
|
||||||
|
SALOMEDS::SObject_wrap curObj;
|
||||||
SALOMEDS::UseCaseIterator_var anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
|
SALOMEDS::UseCaseIterator_var anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
|
||||||
for ( ; anUseCaseIter->More(); anUseCaseIter->Next() ) {
|
for ( ; anUseCaseIter->More(); anUseCaseIter->Next() ) {
|
||||||
anEntry = anUseCaseIter->Value()->GetID();
|
curObj = anUseCaseIter->Value();
|
||||||
last2Pnt_pos = anEntry.rfind( ":" );
|
entry = curObj->GetID();
|
||||||
tagAfter = atoi( anEntry.substr( last2Pnt_pos+1 ).c_str() );
|
anEntry = entry.in();
|
||||||
if ( tagAfter > theTag ) {
|
last2Pnt_pos = anEntry.rfind( ":" );
|
||||||
theFatherObject->FindSubObject( tagAfter, objAfter.inout() );
|
tagAfter = atoi( anEntry.substr( last2Pnt_pos+1 ).c_str() );
|
||||||
break;
|
if ( tagAfter > theTag ) {
|
||||||
}
|
objAfter = curObj;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +317,7 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
|
|||||||
if ( !CORBA::is_nil( objAfter ) ) {
|
if ( !CORBA::is_nil( objAfter ) ) {
|
||||||
useCaseBuilder->InsertBefore( SO, objAfter ); // insert at given tag
|
useCaseBuilder->InsertBefore( SO, objAfter ); // insert at given tag
|
||||||
} else if ( !useCaseBuilder->IsUseCaseNode( SO ) ) {
|
} else if ( !useCaseBuilder->IsUseCaseNode( SO ) ) {
|
||||||
useCaseBuilder->AppendTo( SO->GetFather(), SO ); // append to the end of list
|
useCaseBuilder->AppendTo( theFatherObject, SO ); // append to the end of list
|
||||||
}
|
}
|
||||||
|
|
||||||
return SO._retn();
|
return SO._retn();
|
||||||
|
Loading…
Reference in New Issue
Block a user