From: Bernard Secher Date: Wed, 28 Nov 2018 07:55:25 +0000 (+0100) Subject: destroy connection mananger in naming service at shutdown X-Git-Tag: EMC2P_V1_1_0~15^2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=474427508d9c5d0420b6583ee9cfc63e7729087d;p=modules%2Fkernel.git destroy connection mananger in naming service at shutdown --- diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.cxx b/src/DSC/DSC_Basic/ConnectionManager_i.cxx index 90a5943cf..eda264295 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.cxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.cxx @@ -25,7 +25,6 @@ // Module : KERNEL // #include "ConnectionManager_i.hxx" -#include "SALOME_NamingService.hxx" #ifdef WIN32 # include @@ -33,20 +32,23 @@ # include #endif +const char * ConnectionManager_i::_ConnectionManagerNameInNS = "/ConnectionManager"; + ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) { _orb = CORBA::ORB::_duplicate(orb) ; - SALOME_NamingService * ns = new SALOME_NamingService(orb); - const char * ConnectionManagerNameInNS = "/ConnectionManager"; + _NS = new SALOME_NamingService(orb); CORBA::Object_var obref = _this(); _remove_ref(); - ns->Register(obref, ConnectionManagerNameInNS); - delete ns; + _NS->Register(obref, _ConnectionManagerNameInNS); current_id = 0; pthread_mutex_init(&mutex, NULL); } -ConnectionManager_i::~ConnectionManager_i() {} +ConnectionManager_i::~ConnectionManager_i() +{ + delete _NS; +} Engines::ConnectionManager::connectionId ConnectionManager_i::connect(Engines::DSC_ptr uses_component, @@ -122,6 +124,7 @@ ConnectionManager_i::disconnect(Engines::ConnectionManager::connectionId id, void ConnectionManager_i::ShutdownWithExit() { + _NS->Destroy_Name(_ConnectionManagerNameInNS); ids_it = ids.begin(); while(ids_it != ids.end()) { diff --git a/src/DSC/DSC_Basic/ConnectionManager_i.hxx b/src/DSC/DSC_Basic/ConnectionManager_i.hxx index e3f6f24ce..84c7c94f6 100644 --- a/src/DSC/DSC_Basic/ConnectionManager_i.hxx +++ b/src/DSC/DSC_Basic/ConnectionManager_i.hxx @@ -28,6 +28,7 @@ #define _CONNECTION_MANAGER_I_HXX_ #include "DSC_Basic.hxx" +#include "SALOME_NamingService.hxx" #include #include @@ -74,6 +75,8 @@ class ConnectionManager_i : */ CORBA::Long getPID(); + static const char *_ConnectionManagerNameInNS; + private : struct connection_infos { @@ -96,6 +99,7 @@ class ConnectionManager_i : pthread_mutex_t mutex; protected: CORBA::ORB_var _orb; + SALOME_NamingService * _NS; }; #endif