views:

205

answers:

1
ABRecordRef addressBookRecord = ...;
ABNewPersonViewController *newPersonViewController = [[[ABNewPersonViewController alloc] init] autorelease];
newPersonViewController.newPersonViewDelegate = delegate;
newPersonViewController.displayedPerson = addressBookRecord;

Is it safe to

CFRelease(addressBookRecord);

?

Is there a standard CoreFoundation pattern around this I'm not aware of?

+1  A: 

I don't think it's safe to call CFRelease.
displayedPerson is defined as follows in the header.
So, displayedPerson is just assigned and not copied or retained when we set the value.
Therefore, I think we can't release it.

@property(nonatomic, readwrite) ABRecordRef displayedPerson
tomute
ABRecordRef is a struct, so I don't think we can make inferences about memory ownership based on this property.
Heath Borders
According to the iPhone OS Reference, ABRecordRef is just "const void *". So, I think it's like a primitive type such as int. I guess ABNewPersonViewController just keeps a pointer in it. So, if you release early, it could be a problem.
tomute