Fix crash in salome_test.py

This commit is contained in:
vsr 2013-08-28 11:00:25 +00:00
parent 30bb71dac9
commit 47da75254e
2 changed files with 14 additions and 3 deletions

View File

@ -478,10 +478,19 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theSt
return SALOMEDS::SComponent::_nil();
if(MYDEBUG) MESSAGE("PublishComponent");
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
CORBA::String_var compDataType = ComponentDataType();
SALOMEDS::SComponent_wrap father = theStudy->FindComponent( compDataType.in() );
if ( !CORBA::is_nil( father ) )
if ( !CORBA::is_nil( father ) ) {
// check that the component is added to the use case browser
if ( !useCaseBuilder->IsUseCaseNode( father ) ) {
useCaseBuilder->SetRootCurrent();
useCaseBuilder->Append( father ); // component object is added as the top level item
}
return father._retn();
}
SALOME_ModuleCatalog::ModuleCatalog_var aCat =
SALOME_ModuleCatalog::ModuleCatalog::_narrow( GetNS()->Resolve("/Kernel/ModulCatalog") );
@ -492,8 +501,6 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent(SALOMEDS::Study_ptr theSt
if ( CORBA::is_nil( aComp ) )
return father._retn();
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
SALOMEDS::GenericAttribute_wrap anAttr;
SALOMEDS::AttributePixMap_wrap aPixmap;

View File

@ -380,6 +380,10 @@ SMESH_Swig::Init(int theStudyID)
aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
aPixmap->UnRegister();
SALOMEDS::UseCaseBuilder_var useCaseBuilder = myStudy->GetUseCaseBuilder();
useCaseBuilder->SetRootCurrent();
useCaseBuilder->Append( aSComponent.in() );
myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
if (aLocked)
myStudy->GetProperties()->SetLocked(true);