Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

EXC_BAD_ACCESS when deallocating RBLPopover #75

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

EXC_BAD_ACCESS when deallocating RBLPopover #75

3rdcycle opened this issue Mar 21, 2013 · 4 comments
Labels

Comments

@3rdcycle
Copy link
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
Copy link
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
Copy link
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
Copy link
Contributor Author

3rdcycle commented Jun 3, 2013

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

@jspahrsummers
Copy link
Contributor

Should be fixed by #85.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants