From 1851a57900a72e5c7a397b887b11a299c1dcea5c Mon Sep 17 00:00:00 2001 From: Bernard Secher Date: Tue, 27 Nov 2018 16:13:23 +0100 Subject: [PATCH] do not shutdown launcher server if it is remote --- src/Session/SALOME_Session_Server.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index c82ccc3c6..ea2748167 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -342,10 +342,10 @@ void killOmniNames() } // shutdown standalone servers -void shutdownServers( SALOME_NamingService* theNS ) +void shutdownServers( SALOME_NamingService* theNS, bool remoteLauncher ) { SALOME_LifeCycleCORBA lcc(theNS); - lcc.shutdownServers(); + lcc.shutdownServers(!remoteLauncher); } // ---------------------------- MAIN ----------------------- @@ -447,9 +447,13 @@ int main( int argc, char **argv ) SALOME_NamingService* _NS = 0; GetInterfaceThread* guiThread = 0; Session_ServerLauncher* myServerLauncher = 0; + #if defined(WIN32) && defined(UNICODE) char** new_argv = NULL; #endif + + bool remoteLauncher = false; + try { // ...initialize Python (only once) int _argc = 1; @@ -460,8 +464,10 @@ int main( int argc, char **argv ) ORB_INIT &init = *SINGLETON_::Instance(); ASSERT( SINGLETON_::IsAlreadyExisting() ); int orbArgc = 1; - if( std::string(argv[1]).find("-ORBInitRef") != std::string::npos ) + if( std::string(argv[1]).find("-ORBInitRef") != std::string::npos ){ orbArgc = 3; + remoteLauncher = true; + } orb = init( orbArgc, argv ); CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); @@ -665,7 +671,7 @@ int main( int argc, char **argv ) myServerLauncher->ShutdownAll(); // shutdown embedded servers if ( shutdownAll ) // shutdown standalone servers - shutdownServers( _NS ); + shutdownServers( _NS, remoteLauncher ); if ( myServerLauncher ) myServerLauncher->KillAll(); // kill embedded servers @@ -699,7 +705,7 @@ int main( int argc, char **argv ) abort(); //abort program to avoid deadlock in destructors or atexit when shutdown has been interrupted } - //Destroy orb from python (for chasing memory leaks) + //Destroy orb from python (for chasing msrc/Session/SALOME_Session_Server.cxxemory leaks) //PyRun_SimpleString("from omniORB import CORBA"); //PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)"); //PyRun_SimpleString("orb.destroy()"); -- 2.39.2