]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix Python exception
authorGilles DAVID <gilles-g.david@edf.fr>
Wed, 27 Sep 2023 16:02:31 +0000 (18:02 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 4 Oct 2023 07:23:34 +0000 (09:23 +0200)
src/SALOMESDS/SALOME_DataScopeServer_Common.cxx

index 370c8c36ad01cdc8a38f32524173fe5215fa88c9..7067131d7a2fb809d0eca9b48eb608016001c04f 100644 (file)
@@ -53,32 +53,34 @@ int CommonDataScopeServerMain(int argc, char *argv[], CORBA::ORB_var orb, const
   SALOMESDS::DataScopeKiller *killer(new SALOMESDS::DataScopeKiller(orb));
   SALOME::DataScopeKiller_var killerObj(killer->_this());
   //
-  SALOME_CPythonHelper cPyHelper;
-  cPyHelper.initializePython(argc,argv);
-  //
-  SALOMESDS::DataScopeServerBase *server(nullptr);
-  if(!isTransac)
-    server=new SALOMESDS::DataScopeServer(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb));
-  else
-    server=new SALOMESDS::DataScopeServerTransaction(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb));
-  //
-  CORBA::PolicyList policies;
-  policies.length(3);
-  PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
-  policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
-  policies[1]=poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION);
-  policies[2]=poa->create_id_uniqueness_policy(PortableServer::UNIQUE_ID);
-  PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies));
-  threadPol->destroy();
-  server->registerToSalomePiDict();
-  //
-  server->setPOA(poa2);
-  obj=server->activate();
-  SALOME::DataScopeServerBase_var serverPtr(SALOME::DataScopeServerBase::_narrow(obj));
-  server->registerInNS(serverPtr);
-  //
-  orb->run();
-  delete killer;
+  {
+    SALOME_CPythonHelper cPyHelper;
+    cPyHelper.initializePython(argc,argv);
+    //
+    SALOMESDS::DataScopeServerBase *server(nullptr);
+    if(!isTransac)
+      server=new SALOMESDS::DataScopeServer(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb));
+    else
+      server=new SALOMESDS::DataScopeServerTransaction(&cPyHelper,orb,killerObj,scopeName,nsGenrator(orb));
+    //
+    CORBA::PolicyList policies;
+    policies.length(3);
+    PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+    policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol);
+    policies[1]=poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION);
+    policies[2]=poa->create_id_uniqueness_policy(PortableServer::UNIQUE_ID);
+    PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies));
+    threadPol->destroy();
+    server->registerToSalomePiDict();
+    //
+    server->setPOA(poa2);
+    obj=server->activate();
+    SALOME::DataScopeServerBase_var serverPtr(SALOME::DataScopeServerBase::_narrow(obj));
+    server->registerInNS(serverPtr);
+    //
+    orb->run();
+    delete killer;
+  }
   Py_Finalize();
   return 0;
 }