-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
*/
CORBA::ORB_var SalomeApp_Engine_i::orb()
{
- ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
- // TODO: using QApplication here looks ugly, think how to
- // obtain the ORB reference in a nicer way...
- static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+ static CORBA::ORB_var _orb;
+
+ if ( CORBA::is_nil( _orb ) ) {
+ QStringList args = QApplication::arguments();
+ int argc = args.size();
+ std::vector<std::string> args1(argc);
+ char** argv = new char*[argc];
+ for ( int i = 0; i < argc; ++i ) {
+ args1[i] = args[i].toStdString();
+ argv[i] = const_cast<char*>( args1[i].c_str() );
+ }
+
+ ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+ _orb = init( argc, argv );
+
+ delete [] argv;
+ }
+
return _orb;
}
\param theComponentName - synthetic "component data type" used to identify a given light module
\return Object reference to the CORBA engine
*/
-CORBA::Object_ptr SalomeApp_Engine_i::engineForComponent( const char* theComponentName,
+CORBA::Object_ptr SalomeApp_Engine_i::EngineForComponent( const char* theComponentName,
bool toCreate )
{
CORBA::Object_var anEngine;
if ( !theComponentName || !strlen( theComponentName ) )
return anEngine._retn();
+ if ( SalomeApp_Application::moduleTitle( theComponentName ).isEmpty() )
+ return anEngine._retn();
+
std::string aPath( "/SalomeAppEngine/" );
aPath += theComponentName;
anEngine = namingService()->Resolve( aPath.c_str() );
bool toCreate )
{
std::string anIOR( "" );
- CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
+ CORBA::Object_var anEngine = EngineForComponent( theComponentName, toCreate );
if ( !CORBA::is_nil( anEngine ) )
{
CORBA::String_var objStr = orb()->object_to_string( anEngine.in() );
bool toCreate )
{
SalomeApp_Engine_i* aServant = 0;
- CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
+ CORBA::Object_var anEngine = EngineForComponent( theComponentName, toCreate );
if ( !CORBA::is_nil( anEngine ) )
{
PortableServer::Servant aServantBase = poa()->reference_to_servant( anEngine.in() );