From: eap Date: Wed, 2 Feb 2011 12:04:05 +0000 (+0000) Subject: 0021165: [CEA] Unit test crashes salome session X-Git-Tag: Start_BR_19998_21191~82 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f7ae2e238891abf32f7830e024f10b09b2fa3c6e;p=modules%2Fkernel.git 0021165: [CEA] Unit test crashes salome session interface SObject { + +/*! Returns true if the %SObject does not belong to any %Study +*/ + boolean IsNull(); --- diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 85efbab4c..3ad806384 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -22,7 +22,6 @@ // File : SALOMEDS.idl // Author : Yves FRICAUD -// $Header$ // /*! \file SALOMEDS.idl \brief This file contains a set of interfaces used for creation, management and modification of the %Study @@ -1005,6 +1004,11 @@ Gets the list of open studies /*! Name of the %SObject */ attribute string Name; // equivalent to setName() & getName() + +/*! Returns true if the %SObject does not belong to any %Study +*/ + boolean IsNull(); + /*! Gets an object %ID \return ID of the %SObject. diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 8d513b031..1c87909fa 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -103,6 +103,11 @@ SALOMEDS_SObject::~SALOMEDS_SObject() } } +bool SALOMEDS_SObject::IsNull() const +{ + return _isLocal ? ( !_local_impl || _local_impl->IsNull() ) : _corba_impl->IsNull(); +} + std::string SALOMEDS_SObject::GetID() { std::string aValue; diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index e7d4b3aee..0c9af7362 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -53,6 +53,7 @@ public: SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject); virtual ~SALOMEDS_SObject(); + virtual bool IsNull() const; virtual std::string GetID(); virtual _PTR(SComponent) GetFatherComponent(); virtual _PTR(SObject) GetFather(); diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 8de5670dd..fea239f5e 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -60,6 +60,7 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImp //============================================================================ SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb) { + _impl = 0; if(!impl.IsNull()) { if(impl.IsComponent()) { SALOMEDSImpl_SComponent sco = impl; @@ -84,6 +85,17 @@ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() if(_impl) delete _impl; } +//================================================================================ +/*! + * \brief Returns true if the %SObject does not belong to any %Study + */ +//================================================================================ + +CORBA::Boolean SALOMEDS_SObject_i::IsNull() +{ + SALOMEDS::Locker lock; + return !_impl || _impl->IsNull(); +} //============================================================================ /*! Function :GetID diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index d56372308..6f9de862f 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -54,6 +54,7 @@ public: virtual ~SALOMEDS_SObject_i(); + virtual CORBA::Boolean IsNull(); virtual char* GetID(); virtual SALOMEDS::SComponent_ptr GetFatherComponent(); virtual SALOMEDS::SObject_ptr GetFather() ; diff --git a/src/SALOMEDSClient/SALOMEDSClient_SObject.hxx b/src/SALOMEDSClient/SALOMEDSClient_SObject.hxx index 8fa2d5ac7..9c2ea0803 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_SObject.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_SObject.hxx @@ -42,6 +42,7 @@ class SALOMEDSClient_SObject public: virtual ~SALOMEDSClient_SObject() {} + virtual bool IsNull() const = 0; virtual std::string GetID() = 0; virtual _PTR(SComponent) GetFatherComponent() = 0; virtual _PTR(SObject) GetFather() = 0;