From 21d0c25a579f7f27bbd8bdf879a032af58a5d881 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 18 Feb 2021 14:06:31 +0100 Subject: [PATCH] Before SALOME_NamingService concept creation --- src/Session/SALOME_Session_Server.cxx | 3 ++- src/Session/Session_ServerThread.cxx | 27 ++++++++++++--------------- src/Session/Session_ServerThread.hxx | 5 +++-- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 8c516411a..67fa2103b 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -463,7 +463,8 @@ int AbstractGUIApp::main(int argc, char **argv) QApplication::setOrganizationName("salome"); QApplication::setApplicationName("salome"); QApplication::setApplicationVersion(salomeVersion()); - + int vvvv(90); + std::cin >> vvvv; // Install Qt debug messages handler MsgHandler msgHandler; qInstallMessageHandler(QtxMsgHandler); diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx index 4e7e65f54..d9f28bd01 100644 --- a/src/Session/Session_ServerThread.cxx +++ b/src/Session/Session_ServerThread.cxx @@ -83,9 +83,9 @@ Session_ServerThread::Session_ServerThread(int argc, _orb = CORBA::ORB::_duplicate(orb); _root_poa = PortableServer::POA::_duplicate(poa); _servType =-1; - _NS = new SALOME_NamingService(_orb); // one instance per server to limit - // multi thread coherence problems - _container = 0; // embedded container + _NS.reset( new SALOME_NamingService(_orb) ); // one instance per server to limit + // multi thread coherence problems + _container = nullptr; // embedded container } /*! @@ -93,8 +93,6 @@ Session_ServerThread::Session_ServerThread(int argc, */ Session_ServerThread::~Session_ServerThread() { - //MESSAGE("~Session_ServerThread "<< _argv[0]); - delete _NS; for (int i = 0; i <_argc ; i++ ) free( _argv[i] ); delete[] _argv; @@ -118,42 +116,42 @@ void Session_ServerThread::Init() switch (_servType) { case 0: // Container { - NamingService_WaitForServerReadiness(_NS,"/Registry"); - NamingService_WaitForServerReadiness(_NS,"/ContainerManager"); + NamingService_WaitForServerReadiness(_NS.get(),"/Registry"); + NamingService_WaitForServerReadiness(_NS.get(),"/ContainerManager"); ActivateContainer(_argc, _argv); break; } case 1: // ModuleCatalog { - NamingService_WaitForServerReadiness(_NS,"/Registry"); + NamingService_WaitForServerReadiness(_NS.get(),"/Registry"); ActivateModuleCatalog(_argc, _argv); break; } case 2: // Registry { - NamingService_WaitForServerReadiness(_NS,""); + NamingService_WaitForServerReadiness(_NS.get(),""); ActivateRegistry(_argc, _argv); break; } case 3: // SALOMEDS { - NamingService_WaitForServerReadiness(_NS,"/Kernel/ModulCatalog"); + NamingService_WaitForServerReadiness(_NS.get(),"/Kernel/ModulCatalog"); ActivateSALOMEDS(_argc, _argv); break; } case 4: // Session { - NamingService_WaitForServerReadiness(_NS,"/Study"); + NamingService_WaitForServerReadiness(_NS.get(),"/Study"); std::string containerName = "/Containers/"; containerName = containerName + Kernel_Utils::GetHostname(); containerName = containerName + "/FactoryServer"; - NamingService_WaitForServerReadiness(_NS,containerName); + NamingService_WaitForServerReadiness(_NS.get(),containerName); ActivateSession(_argc, _argv); break; } case 5: // Container Manager { - NamingService_WaitForServerReadiness(_NS,""); + NamingService_WaitForServerReadiness(_NS.get(),""); ActivateContainerManager(_argc, _argv); break; } @@ -234,8 +232,7 @@ void Session_ServerThread::ActivateSALOMEDS(int /*argc*/, char** /*argv*/) } } -void Session_ServerThread::ActivateRegistry(int argc, - char ** argv) +void Session_ServerThread::ActivateRegistry(int argc, char ** argv) { MESSAGE("Registry thread started"); SCRUTE(argc); diff --git a/src/Session/Session_ServerThread.hxx b/src/Session/Session_ServerThread.hxx index 1ea0db34a..03296bf82 100644 --- a/src/Session/Session_ServerThread.hxx +++ b/src/Session/Session_ServerThread.hxx @@ -31,6 +31,7 @@ #include #include +#include void WaitForServerReadiness(std::string serverName); @@ -65,7 +66,7 @@ protected: int _servType; CORBA::ORB_var _orb; PortableServer::POA_var _root_poa; - SALOME_NamingService * _NS; + std::unique_ptr _NS; Engines_Container_i* _container; }; @@ -85,7 +86,7 @@ public: virtual ~Session_SessionThread(); protected: - virtual void ActivateSession ( int argc, char ** argv ); + void ActivateSession ( int argc, char ** argv ) override; private: QMutex* _GUIMutex; QWaitCondition* _GUILauncher; -- 2.39.2