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

Fast clicking on OSX causes over-releasing of _popoverTransiencyMonitor #9

Closed
ghost opened this issue Feb 3, 2014 · 1 comment
Closed

Comments

@ghost
Copy link

ghost commented Feb 3, 2014

I noticed that triple-clicking on the menu bar icon causes a crash in the UI thread. After some debugging, I have found the cause & a (potential) fix.

Original:

- (void)hidePopover
{
    self.active = NO;

    if (_popover && _popover.isShown) {
        [_popover close];
        [NSEvent removeMonitor:_popoverTransiencyMonitor];
    }
}

Fix:

- (void)hidePopover
{
    self.active = NO;
    if (_popover && _popover.isShown) {
        [_popover close];
        if (nil != _popoverTransiencyMonitor) {
            [NSEvent removeMonitor:_popoverTransiencyMonitor];
            _popoverTransiencyMonitor = nil;
        }
    }
}

From the Apple Docs:

_Remove the specified event monitor. You must ensure that eventMonitor is removed only once. Removing the same eventMonitor instance multiple times results in an over-release condition, even in a Garbage Collected environment._

@aschuch
Copy link
Owner

aschuch commented Mar 23, 2014

Thanks, fixed!

@aschuch aschuch closed this as completed Mar 23, 2014
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

1 participant