summaryrefslogtreecommitdiff
path: root/Menes/ObjectHandle.h
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-21 04:13:39 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-21 04:13:39 -0700
commit9599dd2f2bfcc0a9997b6d90989fd02209bd73ee (patch)
treea44ea2d598f372efcd1ce8d9582990114ae6cef5 /Menes/ObjectHandle.h
parent1daa3bc0b0f45048ad98010cac2f1e90a813def5 (diff)
Call setDelegate:nil during _H<> = nil.
Diffstat (limited to 'Menes/ObjectHandle.h')
-rw-r--r--Menes/ObjectHandle.h13
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;
}