Salome HOME
Fix problem with waiting threads on server
authormpa <mpa@opencascade.com>
Tue, 25 Oct 2016 08:13:11 +0000 (11:13 +0300)
committermpa <mpa@opencascade.com>
Tue, 25 Oct 2016 08:13:11 +0000 (11:13 +0300)
src/SALOMEDS/SALOMEDS.cxx
src/SALOMEDS/SALOMEDS_Server.cxx

index 86cfc79968bac50eba25b12b68bfe0ea294f5575..6199d4fed962029c3de95a30d2c3b6989b72031c 100644 (file)
@@ -116,16 +116,15 @@ extern "C"
       // Activate the objects.  This tells the POA that the objects are ready to accept requests.
       PortableServer::ObjectId_var aStudy_iid =  root_poa->activate_object(aStudy_i);
       aStudy = aStudy_i->_this();
-
-      //give ownership to the poa : the object will be deleted by the poa
-      aStudy_i->_remove_ref();
       namingService.Register(aStudy.in(), "/Study");
 
       // Assign the value of the IOR in the study->root
       CORBA::String_var IORStudy = orb->object_to_string(aStudy);
       aStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in());
     }
-    return new SALOMEDS_Study(aStudy_i->GetImpl());
+    SALOMEDS_Study* study = new SALOMEDS_Study(aStudy_i->GetImpl());
+    aStudy_i->_remove_ref();
+    return study;
   }
 
   SALOMEDS_EXPORT
index 2903a821763a0ef04ae111fd2690bbe0ca6546b3..a1e9a1af18d3ce17c064f16416a0fd56f9cc8d42 100644 (file)
@@ -162,11 +162,12 @@ int main(int argc, char** argv)
       PortableServer::ObjectId_var myStudy_iid = poa->activate_object(myStudy_i);
       SALOMEDS::Study_var Study = myStudy_i->_this();
       NS.Register(Study.in(), "/Study");
-      myStudy_i->_remove_ref();
 
       // Assign the value of the IOR in the study->root
       CORBA::String_var IORStudy = orb->object_to_string(Study);
       myStudy_i->GetImpl()->SetTransientReference((char*)IORStudy.in());
+
+      myStudy_i->_remove_ref();
        
       // Obtain a POAManager, and tell the POA to start accepting
       // requests on its objects.