EXC_BAD_ACCESS when deallocating RBLPopover #75

Closed
3rdcycle opened this Issue Mar 21, 2013 · 4 comments

Projects

None yet

3 participants

@3rdcycle
Contributor

Disclaimer: I'm new to this stuff and might simply be doing something wrong.

Deallocating an RBLPopover that was initialized with an RBLViewController causes the app to crash with EXC_BAD_ACCESS in custom_viewWillMoveToWindow: when accessing self.rbl_viewController. My guess is that the associated rbl_viewController already got dealloced and left a dangling pointer.

Here's how I setup the popover:

- (IBAction)showPopover:(id)sender {
    PopoverContentViewController *contentViewController = [[PopoverContentViewController alloc] initWithNibName:@"PopoverContentViewController" bundle:nil];

    self.popover = [[RBLPopover alloc] initWithContentViewController:contentViewController];
    self.popover.behavior = RBLPopoverViewControllerBehaviorTransient;
    [self.popover showRelativeToRect:self.button.bounds ofView:self.button preferredEdge:CGRectMinYEdge];
}

I can send a minimal working example if needed.

@jspahrsummers
Contributor

Thanks for reporting this! Seems like we aren't zeroing out rbl_viewController properly. We'd be happy to review a pull request fixing this, if anyone wants to take a stab at it.

@anozaki
Contributor
anozaki commented May 13, 2013

The fix I put in does fix this issue but the problem lies else where for the code snippet in this bug.

The problem is contentViewController is going out of scope and getting deallocated at the end of this function.

@3rdcycle
Contributor
3rdcycle commented Jun 3, 2013

Thanks.
I think RBLPopopver retains the contentViewController, so it should be fine.

@jspahrsummers
Contributor

Should be fixed by #85.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment