Salome HOME
Fix TestExportToGEOM.py case in SSL mode
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 25 Jun 2021 15:21:18 +0000 (17:21 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 25 Jun 2021 15:21:18 +0000 (17:21 +0200)
src/SALOMEDS/SALOMEDS_Driver_i.hxx
src/SALOMEDS/SALOMEDS_Study_i.cxx

index 036c6c9e25fef60f8749d290b24073ad811ca159..8ba6a897f98db7981733f99ba942338746a93b1b 100644 (file)
@@ -119,6 +119,8 @@ public:
   
   SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB, SALOME_NamingService_Abstract *ns);
 
+  SALOME_NamingService_Abstract *getNS() const { return _name_service; }
+
   virtual ~SALOMEDS_DriverFactory_i();
    
   virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType);
index f5dedf60f5d911650459a2c914a68ed555cfa331..96a37ba1d58e90d0d447a7b273bfe16805b542d1 100644 (file)
@@ -51,6 +51,9 @@
 
 #include "Basics_Utils.hxx"
 #include "SALOME_KernelServices.hxx"
+#include "SALOME_Fake_NamingService.hxx"
+
+#include <memory>
 
 #ifdef WIN32
 #include <process.h>
@@ -80,7 +83,8 @@ SALOMEDS::Study_ptr KERNEL::getStudyServantSA()
     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
     _poa = PortableServer::POA::_duplicate(poa);
-    SALOMEDS_Study_i *servant = new SALOMEDS_Study_i(orb,SALOME::Session::_nil());
+    SALOME_Fake_NamingService ns;
+    SALOMEDS_Study_i *servant = new SALOMEDS_Study_i(orb,&ns);
     _study = servant->_this();
   }
   return SALOMEDS::Study::_duplicate(_study);
@@ -1220,10 +1224,11 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath,
     throw SALOMEDS::Study::StudyInvalidReference();  
 
   std::string aPath((char*)thePath), aBaseName((char*)theBaseName);
-  SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb);
-  bool ret = _impl->DumpStudy(aPath, aBaseName, isPublished, isMultiFile, factory);
-  delete factory;
-
+  bool ret = false;
+  {
+    std::unique_ptr<SALOMEDS_DriverFactory_i> factory( new SALOMEDS_DriverFactory_i(_orb,_factory->getNS()) );
+    ret = _impl->DumpStudy(aPath, aBaseName, isPublished, isMultiFile, factory.get());
+  }
   return ret;
 }