EXC_BAD_ACCESS when trying to release an ABRecordRef
Posted
by synic
on Stack Overflow
See other posts from Stack Overflow
or by synic
Published on 2010-05-21T21:11:29Z
Indexed on
2010/05/21
21:20 UTC
Read the original article
Hit count: 296
I've got the following class that is a wrapper around an 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've left some of the methods out, but they aren't relevant to this question.
Everything works fine, except I get an EXC_BAD_ACCESS
on the if(person) CFRelease(person);
line. Why does this happen? I'm not calling CFRelease or CFRetain at all anywhere else in my app.
© Stack Overflow or respective owner