diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-09 21:27:05 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-09 21:27:05 +0000 |
commit | 36ab859812b278e2d08aeac783de85d4a735e52f (patch) | |
tree | 4f4b3a057651dabed9e1212212761488edf52c33 /TAO | |
parent | 6c46eba28cb89ed9bf709f7069d1c1a75d197a88 (diff) | |
download | ATCD-36ab859812b278e2d08aeac783de85d4a735e52f.tar.gz |
Changed one branch of >>= (to_object) to reflect the change in
CORBA 2.3 - that the caller is responsible for release. Also
add ACE_NEW check for allocation in the other branch.
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/tao/Any.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index f407c9f8aac..bf75de84497 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -844,7 +844,11 @@ CORBA_Any::operator>>= (to_object obj) const { if (this->any_owns_data_ && this->value_) { - obj.ref_ = *(CORBA::Object_ptr *) this->value_; + // CORBA 2.3 has changed the behavior of this operator. Caller + // is now responsible for release. + obj.ref_ = + CORBA::Object::_duplicate (*(CORBA::Object_ptr *) this->value_); + return 1; } else @@ -857,18 +861,26 @@ CORBA_Any::operator>>= (to_object obj) const TAO_ORB_Core_instance ()); CORBA::Boolean flag = (stream.decode (CORBA::_tc_Object, - &obj.ref_, 0, env) - == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1:0; + &obj.ref_, + 0, + env) + == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1 : 0; + if (flag) { - CORBA::Object_ptr *tmp = new CORBA::Object_ptr; + CORBA::Object_ptr *tmp; + + ACE_NEW_RETURN (tmp, + CORBA::Object_ptr, + 0); + *tmp = obj.ref_; - ACE_const_cast (CORBA_Any *, - this)->value_ = tmp; + + ACE_const_cast (CORBA_Any *, this)->value_ = tmp; + return 1; } - // we own this allocated value - // this->value_ = obj.ref_; + return flag; } } |