0

At this point I'm not sure if these leaks might be CoreData related or what, since I've experienced 48 byte strdup leaks in other parts of this same app for apparently different reasons - see my other question:another stack overflow question

But, assuming no relation, I have a viewController which, based on the user selecting an option, presents an ABPeoplePicker. However, it seems like just by presenting the picker I'm leaking, regardless of choosing a contact or not.

The code for presenting the picker is:

- (void)showPeoplePickerController
{
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    picker.displayedProperties = [NSArray arrayWithObject:[NSNumber numberWithInt:kABPersonEmailProperty]];
    picker.peoplePickerDelegate = self;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

And the delegate methods implemented as follow:

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker
{
    [self dismissModalViewControllerAnimated:YES];
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
      shouldContinueAfterSelectingPerson:(ABRecordRef)person 
{
    return YES;
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker
      shouldContinueAfterSelectingPerson:(ABRecordRef)person
                                property:(ABPropertyID)property
                              identifier:(ABMultiValueIdentifier)identifier
{
    ABMultiValueRef emails = ABRecordCopyValue(person, property);

    if(userEmailString)
        [userEmailString release];

    userEmailString = (NSString*)ABMultiValueCopyValueAtIndex(emails, identifier);

    CFRelease(emails);

    [[NSNotificationCenter defaultCenter] postNotificationName:@"recipientEmailDidUpdateNotification"  
                                                        object:self]; 
    return NO;
}

And just in case, userEmailString is a retained NSString property of the controller (meaning I could also go for self.userEmailString = blah).

These are screenshots from Instruments, reporting the leak. But notice that it thinks its the picker not being released, though I am calling release after presenting it. And I've also tried doing CFRelease() instead... but still the same.

enter image description here

enter image description here

enter image description here

Community
  • 1
  • 1
SaldaVonSchwartz
  • 3,669
  • 2
  • 37
  • 76

1 Answers1

1

Anyway, yep.. the leaks are in the SDK.

SaldaVonSchwartz
  • 3,669
  • 2
  • 37
  • 76