From 1074caad1ab3cd35c725943c0e9d550d016ee3c3 Mon Sep 17 00:00:00 2001 From: caremoli Date: Wed, 9 Dec 2009 12:59:08 +0000 Subject: [PATCH] CCAR: change implementation of getContainerName to avoid lock with python container --- src/Container/Component_i.cxx | 15 ++++++++++++++- src/Container/SALOME_Component_i.hxx | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 66d3cd22a..51e5b02d6 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -114,6 +114,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _contId = contId ; CORBA::Object_var o = _poa->id_to_reference(*contId); // container ior... _container=Engines::Container::_narrow(o); + setContainerName(); if(regist) { @@ -164,6 +165,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); _container=Engines::Container::_duplicate(container); + setContainerName(); const CORBA::String_var ior = _orb->object_to_string(_container); if(regist) _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); @@ -1046,6 +1048,17 @@ Engines_Component_i::configureSalome_file(std::string service_name, */ //============================================================================= std::string Engines_Component_i::getContainerName() +{ + return _containerName; +} +//============================================================================= +/*! + * C++ method: set the name of the container associated with this component (attribute _containerName) + * This name does not contains the "/Containers" string and all "/" are replaced by "_" + * \return the container name (reformatted) + */ +//============================================================================= +void Engines_Component_i::setContainerName() { CORBA::String_var containerName=_container->name(); std::string name(containerName); @@ -1053,5 +1066,5 @@ std::string Engines_Component_i::getContainerName() string::size_type slash =name.find_first_of('/'); if(slash != std::string::npos) name[slash]='_'; - return name; + _containerName=name; } diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 652f637a7..364b4afcc 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -120,6 +120,7 @@ public: PortableServer::ObjectId * getId(); Engines_Container_i *GetContainerPtr(); std::string getContainerName(); + void setContainerName(); virtual bool setStudyId(CORBA::Long studyId); static bool isMultiStudy(); @@ -148,6 +149,7 @@ protected: std::string _instanceName ; std::string _interfaceName ; + std::string _containerName ; CORBA::ORB_var _orb; PortableServer::POA_var _poa; -- 2.39.2