return false;
}
+void killOmniNames( )
+{
+ QString fileName( ::getenv ("OMNIORB_CONFIG") );
+ QString portNumber;
+ if ( !fileName.isEmpty() )
+ {
+ QFile aFile( fileName );
+ if ( aFile.open(IO_ReadOnly) ) {
+ QRegExp re("InitRef = .*:([0-9]+)$");
+ QTextStream stream ( &aFile );
+ while ( !stream.atEnd() ) {
+ QString textLine = stream.readLine();
+ if ( re.search( textLine ) > -1 )
+ portNumber = re.cap(1);
+ }
+ aFile.close();
+ }
+ }
+
+ if ( !portNumber.isEmpty() )
+ {
+ QString cmd ;
+ cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber );
+ system ( cmd.latin1() );
+ }
+}
+
// shutdown standalone servers
void shutdownServers( SALOME_NamingService* theNS )
{
CORBA::Object_var objSDS = theNS->Resolve("/myStudyManager");
SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ;
if ( !CORBA::is_nil(studyManager) && ( session->getPID() != studyManager->getPID() ) )
- studyManager->ShutdownWithExit();
+ studyManager->Shutdown();
// 7) ModuleCatalog
CORBA::Object_var objMC=theNS->Resolve("/Kernel/ModulCatalog");
SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objMC);
if ( !CORBA::is_nil(catalog) && ( session->getPID() != catalog->getPID() ) )
- catalog->ShutdownWithExit();
+ catalog->shutdown();
// 8) Registry
CORBA::Object_var objR = theNS->Resolve("/Registry");
Registry::Components_var registry = Registry::Components::_narrow(objR);
if ( !CORBA::is_nil(registry) && ( session->getPID() != registry->getPID() ) )
- registry->end();
+ registry->Shutdown();
// 9) Kill OmniNames
- QString fileName( ::getenv ("OMNIORB_CONFIG") );
- QString portNumber;
- if ( !fileName.isEmpty() ) {
- QFile aFile( fileName );
- if ( aFile.open(IO_ReadOnly) ) {
- QRegExp re("InitRef = .*:([0-9]+)$");
- QTextStream stream ( &aFile );
- while ( !stream.atEnd() ) {
- QString textLine = stream.readLine();
- if ( re.search( textLine ) > -1 )
- portNumber = re.cap(1);
- }
- aFile.close();
- }
- }
- if ( !portNumber.isEmpty() ) {
- QString cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber );
- system ( cmd.latin1() );
- }
+ //killOmniNames();
}
}
delete myServerLauncher;
delete _NS;
- LocalTraceBufferPool *bp1 = LocalTraceBufferPool::instance();
- LocalTraceBufferPool::deleteInstance(bp1);
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ Py_Finalize();
+
+ try
+ {
+ orb->destroy();
+ }
+ catch(...)
+ {
+ std::cerr << "Caught unexpected exception on destroy : ignored !!" << std::endl;
+ }
+
+ killOmniNames();
return result;
}
// Tell the POA that the objects are ready to accept requests.
- _root_poa->activate_object (Catalogue_i);
+ PortableServer::ObjectId_var id= _root_poa->activate_object (Catalogue_i);
+ Catalogue_i->_remove_ref();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
+ CORBA::Object_var myCata = Catalogue_i->_this();
_NS->Register(myCata ,"/Kernel/ModulCatalog");
}
catch(CORBA::SystemException&)
{
MESSAGE("SalomeApp_Engine thread started");
SalomeApp_Engine_i* anEngine = new SalomeApp_Engine_i();
- /*PortableServer::ObjectId_var id = */_root_poa->activate_object( anEngine );
+ PortableServer::ObjectId_var id =_root_poa->activate_object( anEngine );
MESSAGE("poa->activate_object( SalomeApp_Engine )");
CORBA::Object_var obj = anEngine->_this();
+ anEngine->_remove_ref();
_NS->Register( obj ,"/SalomeAppEngine");
}
CORBA::Object_var obj = mySALOME_Session->_this();
CORBA::String_var sior(_orb->object_to_string(obj));
+ mySALOME_Session->_remove_ref();
mySALOME_Session->NSregister();
}
_poa = PortableServer::POA::_duplicate(poa) ;
_GUIMutex = GUIMutex;
_GUILauncher = GUILauncher;
+ _NS = new SALOME_NamingService(_orb);
//MESSAGE("constructor end");
}
*/
SALOME_Session_i::~SALOME_Session_i()
{
+ delete _NS;
//MESSAGE("destructor end");
}
*/
void SALOME_Session_i::NSregister()
{
- SALOME::Session_ptr pSession = SALOME::Session::_narrow(_this());
+ CORBA::Object_var obref=_this();
+ SALOME::Session_var pSession = SALOME::Session::_narrow(obref);
try
{
- _NS = new SALOME_NamingService(_orb);
_NS->Register(pSession, "/Kernel/Session");
}
catch (ServiceUnreachable&)