Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observation leak when calling dismissPopoverAnimated #162

Open
boazin opened this issue Mar 21, 2015 · 6 comments
Open

Observation leak when calling dismissPopoverAnimated #162

boazin opened this issue Mar 21, 2015 · 6 comments

Comments

@boazin
Copy link

boazin commented Mar 21, 2015

On iOS7 only (iOS8 it's OK) - when manually doing
[popoverController dismissPopoverAnimated:YES];

And than trying to re-open the popover (using presentPopoverFromRect)

I'm getting:

An instance 0x7fa658d31340 of class NewChapterViewController was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x7fa65b01eda0> (
<NSKeyValueObservance 0x7fa658ca31d0: Observer: 0x7fa658d33220, Key path: preferredContentSize, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fa658c829f0>

Tried to debug it - it seems that this is the preferredContentSize but this is as far as I succeeded

@franklau12
Copy link

I have the same problem. It also happens on iOS 8 for me.

@alexrogachev
Copy link

Got the same problem. Repro is to try to display popover while dismiss animation is still going on, I think, or something like that. I reproduced the crash basically by tapping very fast on a button inside my view controller that shows the popover.

Fixed by adding this to the beginning of [WYPopoverController dealloc] method:

    @try {
        if ([viewController respondsToSelector:@selector(preferredContentSize)]) {
            [viewController removeObserver:self forKeyPath:NSStringFromSelector(@selector(preferredContentSize))];
        } else {
            [viewController removeObserver:self forKeyPath:NSStringFromSelector(@selector(contentSizeForViewInPopover))];
        }
    }
    @catch (NSException * __unused exception) {}

@kamarshad
Copy link

@alexrogachev In this way application might crashed even my application is crashing if I tap very fast on button (which use to display popover).
Any alternate to fix that

@woodydaniel
Copy link

Has this issue been addressed?
Also getting this crash

@vitalys
Copy link

vitalys commented Feb 2, 2016

@woodydaniel This repository is abandoned. Try this one: https://github.com/sammcewan/WYPopoverController

@woodydaniel
Copy link

Thanks @vitalys

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

No branches or pull requests

6 participants