I have the following class, which is a wrapper around ABPerson (ABRecordRef):
@interface Recipient : NSObject {
ABRecordRef person;
}
- (id)initWithPerson:(ABRecordRef)person;
@end
@implementation
- (id)initWithPerson:(ABRecordRef)_person {
if(self = [super init]) person = CFRetain(_person);
return self;
}
- (void)dealloc {
if(person) CFRelease(person);
[super dealloc];
}
@end
I left some of the methods, but they are not relevant to this issue.
Everything works fine, except what I get EXC_BAD_ACCESSin line if(person) CFRelease(person);. Why is this happening? I do not call CFRelease or CFRetain anywhere in my application.
Edit, another note: if I add this right in front of the CFRelease line:
NSLog(@"retain count is %d", CFGetRetainCount(person));
He is typing retain count is 1
synic source
share