diff options
-rw-r--r-- | ACE/ChangeLog | 6 | ||||
-rw-r--r-- | ACE/ace/Bound_Ptr.inl | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 7fdabed8c83..5a5008c2e41 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 24 22:45:37 UTC 2007 Steve Huston <shuston@riverace.com> + + * ace/Bound_Ptr.inl (operator=): Check for assign-to-self first; + the code would work assigning to self (as the comment states) but + why do it? Also resolves some compile warnings on HP aC++. + Tue Jul 24 20:38:50 UTC 2007 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> * COPYING: Updated this file to reflect 2007. diff --git a/ACE/ace/Bound_Ptr.inl b/ACE/ace/Bound_Ptr.inl index c99cf0843f3..6bc1e993e20 100644 --- a/ACE/ace/Bound_Ptr.inl +++ b/ACE/ace/Bound_Ptr.inl @@ -191,7 +191,10 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::~ACE_Strong_Bound_Ptr (void) template <class X, class ACE_LOCK> inline void ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &rhs) { - // This will work if &r == this, by first increasing the ref count + // This will work if &r == this, by first increasing the ref count, but + // why go through all that? + if (&rhs == this) + return; COUNTER *new_counter = rhs.counter_; X_t *new_ptr = rhs.ptr_; @@ -205,7 +208,10 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Strong_Bound_Ptr<X, ACE template <class X, class ACE_LOCK> inline void ACE_Strong_Bound_Ptr<X, ACE_LOCK>::operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &rhs) { - // This will work if &r == this, by first increasing the ref count + // This will work if &r == this, by first increasing the ref count, but + // why go through all that? + if (&rhs == this) + return; COUNTER *new_counter = rhs.counter_; X_t *new_ptr = rhs.ptr_; |