Salome HOME
destroy containers in naming service at the end of session bsr/resmgr
authorBernard Secher <bernard.secher@cea.fr>
Thu, 29 Nov 2018 13:28:33 +0000 (14:28 +0100)
committerBernard Secher <bernard.secher@cea.fr>
Thu, 28 Mar 2019 13:50:59 +0000 (14:50 +0100)
src/Session/Session_Session_i.cxx
src/Session/Session_Session_i.hxx

index 84639235620e1645d053d6c48dfadc513fc608ad..05a6e34b4567e9a19eb3b18777e7298709271e4d 100644 (file)
@@ -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<std::string> machines = _NS->list_subdirs();
+  for(int i=0;i<machines.size();i++){
+    _NS->Change_Directory(machines[i].c_str());
+    std::vector<std::string> toto = _NS->list_directory();
+    for(int j=0;j<toto.size();j++)
+      _NS->Destroy_Name(toto[j].c_str());
+    std::vector<std::string> containers = _NS->list_subdirs();
+    for(int j=0;j<containers.size();j++){
+      _NS->Change_Directory(containers[j].c_str());
+      std::vector<std::string> modules = _NS->list_directory();
+      for(int k=0;k<modules.size();k++)
+        _NS->Destroy_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");
+}
index 37111ee76485d72059744bbf51a7fbbd67093d62..f2b1134468eabb77a20fed05efb9cf3c211cf877 100644 (file)
@@ -95,6 +95,8 @@ protected:
   CORBA::ORB_var _orb;
   PortableServer::POA_var _poa;
   bool _isShuttingDown;
+
+  void deleteContainersinNS();
 };
 
 #endif