From 32d96958f07dfde87a4d2676231b51507275e6f7 Mon Sep 17 00:00:00 2001 From: Bernard Secher Date: Thu, 29 Nov 2018 14:28:33 +0100 Subject: [PATCH] destroy containers in naming service at the end of session --- src/Session/Session_Session_i.cxx | 28 ++++++++++++++++++++++++++++ src/Session/Session_Session_i.hxx | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx index 846392356..05a6e34b4 100644 --- a/src/Session/Session_Session_i.cxx +++ b/src/Session/Session_Session_i.cxx @@ -137,6 +137,7 @@ void SALOME_Session_i::NSunregister() { _NS->Destroy_Name("/Kernel/Session"); _NS->Destroy_Directory("/Kernel"); + deleteContainersinNS(); } catch (ServiceUnreachable&) { @@ -342,3 +343,30 @@ SALOME::StringSeq* SALOME_Session_i::getSelection() _GUIMutex->unlock(); return selection._retn(); } + +void SALOME_Session_i::deleteContainersinNS() +{ +// destroy of all containers and modules + _NS->Change_Directory("/Containers"); + std::vector machines = _NS->list_subdirs(); + for(int i=0;iChange_Directory(machines[i].c_str()); + std::vector toto = _NS->list_directory(); + for(int j=0;jDestroy_Name(toto[j].c_str()); + std::vector containers = _NS->list_subdirs(); + for(int j=0;jChange_Directory(containers[j].c_str()); + std::vector modules = _NS->list_directory(); + for(int k=0;kDestroy_Name(modules[k].c_str()); + _NS->Change_Directory("/Containers"); + _NS->Change_Directory(machines[i].c_str()); + _NS->Destroy_Directory(containers[j].c_str()); + } + _NS->Change_Directory("/Containers"); + _NS->Destroy_Directory(machines[i].c_str()); + } + _NS->Change_Directory("/"); + _NS->Destroy_Directory("/Containers"); +} diff --git a/src/Session/Session_Session_i.hxx b/src/Session/Session_Session_i.hxx index 37111ee76..f2b113446 100644 --- a/src/Session/Session_Session_i.hxx +++ b/src/Session/Session_Session_i.hxx @@ -95,6 +95,8 @@ protected: CORBA::ORB_var _orb; PortableServer::POA_var _poa; bool _isShuttingDown; + + void deleteContainersinNS(); }; #endif -- 2.39.2