BugID 9168, Changed the way of creation of GEOM_Engine, no it's stored in satatic varibale, which is initialized only once

This commit is contained in:
srn 2005-12-20 08:07:19 +00:00
parent 2c7236aa9e
commit 957bbeb9e8
2 changed files with 10 additions and 4 deletions

View File

@ -118,8 +118,11 @@ bool GEOM_SelectionFilter::getShape (const GEOM::GEOM_Object_ptr& theObject,
if ( app ) if ( app )
{ {
SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() ); SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( app->namingService() );
static GEOM::GEOM_Gen_var geomGen;
if(CORBA::is_nil( geomGen )) {
Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" );
GEOM::GEOM_Gen_var geomGen = GEOM::GEOM_Gen::_narrow( comp ); geomGen = GEOM::GEOM_Gen::_narrow( comp );
}
if ( !CORBA::is_nil( geomGen ) ) if ( !CORBA::is_nil( geomGen ) )
{ {
TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject ); TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( geomGen, theObject );

View File

@ -45,8 +45,11 @@ static bool getShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theS
{ {
if ( !CORBA::is_nil( theObject ) ) if ( !CORBA::is_nil( theObject ) )
{ {
static GEOM::GEOM_Gen_var myGeom;
if(CORBA::is_nil(myGeom) {
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", "GEOM" ); Engines::Component_var comp = QAD_Application::getDesktop()->getEngine( "FactoryServer", "GEOM" );
GEOM::GEOM_Gen_var myGeom = GEOM::GEOM_Gen::_narrow( comp ); myGeom = GEOM::GEOM_Gen::_narrow( comp );
}
TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( myGeom, theObject ); TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( myGeom, theObject );
if ( !aTopoDSShape.IsNull() ) if ( !aTopoDSShape.IsNull() )