summaryrefslogtreecommitdiff
path: root/ace/Refcounted_Auto_Ptr.i
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Refcounted_Auto_Ptr.i')
-rw-r--r--ace/Refcounted_Auto_Ptr.i24
1 files changed, 11 insertions, 13 deletions
diff --git a/ace/Refcounted_Auto_Ptr.i b/ace/Refcounted_Auto_Ptr.i
index 34ff9fcc10f..67763e3ae39 100644
--- a/ace/Refcounted_Auto_Ptr.i
+++ b/ace/Refcounted_Auto_Ptr.i
@@ -65,19 +65,17 @@ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::assign (ACE_Refcounted_Auto_Ptr_Rep<X,
ACE_ASSERT (rep != 0);
ACE_ASSERT (new_rep != 0);
- ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *old = 0;
- {
- // detached old last for exception safety
- ACE_GUARD (ACE_LOCK, guard, rep->lock_);
- old = rep;
- rep = new_rep;
-
- if (old->ref_count_-- > 0)
- return;
-
- } // The lock is released before deleting old rep object below.
-
- delete old;
+ ACE_GUARD (ACE_LOCK, guard, rep->lock_);
+
+ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *old = rep;
+ rep = new_rep;
+
+ // detached old last for exception safety
+ if(old->ref_count_-- == 0)
+ // We do not need the lock when deleting the representation.
+ // There should be no side effects from deleting rep and we don
+ // not want to release a deleted mutex.
+ delete old;
}
template <class X, class ACE_LOCK> inline