diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-06 03:08:27 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-05-06 03:08:27 +0000 |
commit | a524b12f7f476496b5944d6d19980c5984734583 (patch) | |
tree | b65d7afe4965bc753c91b45fc7a9346fe96c0784 | |
parent | 9894262ae0836736bd92ed1679441927292694fc (diff) | |
download | ATCD-a524b12f7f476496b5944d6d19980c5984734583.tar.gz |
*** empty log message ***
-rw-r--r-- | ace/Message_Block.cpp | 20 | ||||
-rw-r--r-- | ace/Message_Block.h | 1 |
2 files changed, 13 insertions, 8 deletions
diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index a72c4aa1104..cd5e6d154bb 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -428,11 +428,17 @@ ACE_Data_Block::release_i (ACE_Message_Block *mb) if (this->reference_count_ == 0) { delete this; - // We need to delete <mb> here since the lock will be held - // correctly at this point, which protects against race - // conditions in multi-threaded programs. Note that if <mb> is - // 0 there's no harm in deleting it. - delete mb; + + if (mb != 0) + { + // We need to delete <mb> here since the lock will be held + // correctly at this point, which protects against race + // conditions in multi-threaded programs. Note that we must + // reset <mb->data_block_> to 0 or else we'll end up in + // infinite recursion. + mb->data_block_ = 0; + delete mb; + } } else // if (this->reference_count_ > 0) result = this; @@ -462,9 +468,7 @@ ACE_Message_Block::release (void) { ACE_TRACE ("ACE_Message_Block::release"); - this->data_block_ = this->data_block ()->release (this); - - if (this->data_block_ == 0) + if (this->data_block ()->release (this) == 0) return 0; else return this; diff --git a/ace/Message_Block.h b/ace/Message_Block.h index 7137b88fa6c..a12e369b1d3 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -48,6 +48,7 @@ class ACE_Export ACE_Message_Block // <next_> pointers to form a queue of messages (e.g., this is how // <ACE_Message_Queue> works). { + friend class ACE_Data_Block; public: enum ACE_Message_Type { |