From: jfa Date: Tue, 25 Oct 2005 10:09:35 +0000 (+0000) Subject: PAL10385: CreateAndDisplayGO does not work properly when reopening a study X-Git-Tag: V2_2_6~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=163fb83e85432ff4b4c6db26b3219fc0a819529d;p=modules%2Fgeom.git PAL10385: CreateAndDisplayGO does not work properly when reopening a study --- diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index 9c1ef575f..277f1e4b2 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -111,13 +111,20 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry) CORBA::String_var aFatherIOR; SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - aStudyBuilder->DefineComponentInstance(father, Geom); - father->ComponentIOR(aFatherIOR); + if (father->_is_nil()) + return; + if (!father->ComponentIOR(aFatherIOR)) { + aStudyBuilder->LoadWith(father, Geom); + father->ComponentIOR(aFatherIOR); + } SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(ActiveStudy->getActiveStudyFrame()->entry()); SALOMEDS::SObject_var obj = aStudy->FindObjectID(myEntry.c_str()); + if (obj->_is_nil()) + return; + SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; // Create new actor @@ -129,7 +136,7 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry) GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue); TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape); - if (!obj->_is_nil()) { + if (!Shape.IsNull()) { if (obj->FindAttribute(anAttr, "AttributeName")) { SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); CORBA::String_var aNameValue = aName->Value();