diff options
author | bala <balanatarajan@users.noreply.github.com> | 2001-07-15 14:45:34 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2001-07-15 14:45:34 +0000 |
commit | fd367909e43e09651db218167b5c1a122c16c035 (patch) | |
tree | 3c69134e2c1d012fe75aae90922db2fa8d21e5b5 /TAO/tao/Sequence.i | |
parent | 56df453d26f0041374d2b9046cfb0ebcc150c6ea (diff) | |
download | ATCD-fd367909e43e09651db218167b5c1a122c16c035.tar.gz |
ChangeLogTag:Sun Jul 15 9:33:34 2001 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Sequence.i')
-rw-r--r-- | TAO/tao/Sequence.i | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/TAO/tao/Sequence.i b/TAO/tao/Sequence.i index bd1078e1deb..39d6f3f1a76 100644 --- a/TAO/tao/Sequence.i +++ b/TAO/tao/Sequence.i @@ -354,7 +354,29 @@ TAO_Unbounded_Sequence<CORBA::Octet>::replace (CORBA::ULong length, const ACE_Message_Block* mb) { this->_deallocate_buffer (); - this->mb_ = ACE_Message_Block::duplicate (mb); + + // Get the message block flags. + ACE_Message_Block::Message_Flags flg = mb->flags (); + + // If the DONT_DELETE flag is disabled just a duplicate would + // help. If the DONT_DELETE flag is enabled a deep copy is needed as + // the contents would be on stack. Just incrementing the ref count + // on the stack based data block would only crash the program when + // the stack unwinds + if (ACE_BIT_DISABLED (flg, + ACE_Message_Block::DONT_DELETE)) + { + this->mb_ = ACE_Message_Block::duplicate (mb); + } + else + { + // As we are in CORBA mode, all the data blocks would be aligned + // on an 8 byte boundary + ACE_Message_Block msgb (*mb, + ACE_CDR::MAX_ALIGNMENT); + + this->mb_ = ACE_Message_Block::duplicate (&msgb); + } this->buffer_ = this->mb_->rd_ptr (); this->maximum_ = length; this->length_ = length; |