diff options
Diffstat (limited to 'Menes/ObjectHandle.h')
-rw-r--r-- | Menes/ObjectHandle.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Menes/ObjectHandle.h b/Menes/ObjectHandle.h index 188ec1a..c4f4d1a 100644 --- a/Menes/ObjectHandle.h +++ b/Menes/ObjectHandle.h @@ -79,10 +79,10 @@ class MenesObjectHandle { CFRetain((CFTypeRef) value_); } - _finline void Clear_() { - if (value_ != nil) { - MenesObjectHandle_<Type_, Delegate_>::Execute(value_); - CFRelease((CFTypeRef) value_); + _finline void Release_(Type_ *value) { + if (value != nil) { + MenesObjectHandle_<Type_, Delegate_>::Execute(value); + CFRelease((CFTypeRef) value); } } @@ -100,7 +100,7 @@ class MenesObjectHandle { } _finline ~MenesObjectHandle() { - Clear_(); + Release_(value_); } _finline operator Type_ *() const { @@ -112,8 +112,7 @@ class MenesObjectHandle { Type_ *old(value_); value_ = value; Retain_(); - if (old != nil) - CFRelease((CFTypeRef) old); + Release_(old); } return *this; } |