summaryrefslogtreecommitdiff
path: root/ACE/ace/Unbounded_Set_Ex.cpp
diff options
context:
space:
mode:
authorPhil Mesnier <mesnierp@ociweb.com>2015-11-10 11:22:11 -0600
committerPhil Mesnier <mesnierp@ociweb.com>2015-11-10 11:22:11 -0600
commit9975e8b418d17abdad05f3b0359eff2a033a9e1b (patch)
tree95f3f84259cc7347e80879fa5acdfa8b3023de24 /ACE/ace/Unbounded_Set_Ex.cpp
parentf564ccd575f33bb82cb43fdd5952dfcd5fbf7556 (diff)
downloadATCD-9975e8b418d17abdad05f3b0359eff2a033a9e1b.tar.gz
Clear the dummy reference value used when searching for an entry to remove. If the items stored in the set are of a reference counted type, then this is necessary to ensure there are no lingering references to otherwise cleaned up objects.
Diffstat (limited to 'ACE/ace/Unbounded_Set_Ex.cpp')
-rw-r--r--ACE/ace/Unbounded_Set_Ex.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/ACE/ace/Unbounded_Set_Ex.cpp b/ACE/ace/Unbounded_Set_Ex.cpp
index 7692a4039c9..ac54083a489 100644
--- a/ACE/ace/Unbounded_Set_Ex.cpp
+++ b/ACE/ace/Unbounded_Set_Ex.cpp
@@ -226,7 +226,7 @@ ACE_Unbounded_Set_Ex<T, C>::remove (const T &item)
{
// ACE_TRACE ("ACE_Unbounded_Set_Ex<T, C>::remove");
- // Insert the item to be founded into the dummy node.
+ // Insert the item to be found into the dummy node.
this->head_->item_ = item;
NODE *curr = this->head_;
@@ -234,6 +234,11 @@ ACE_Unbounded_Set_Ex<T, C>::remove (const T &item)
while (!(this->comp_ (curr->next_->item_, item)))
curr = curr->next_;
+ // reset the dummy node. This ensures reference counted items are
+ // completely released. Without this, a reference can linger as
+ // the dummy long after it was removed from the list.
+ this->head_->item_ = T();
+
if (curr->next_ == this->head_)
return -1; // Item was not found.
else