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

OUIEditMenuController inhibitMenuFor incorrect assertion #76

Open
memmons opened this issue May 6, 2013 · 0 comments
Open

OUIEditMenuController inhibitMenuFor incorrect assertion #76

memmons opened this issue May 6, 2013 · 0 comments

Comments

@memmons
Copy link

memmons commented May 6, 2013

inhibitMenuFor is found in OUIEditMenuController and is called by ancestorScrollViewWillBeginScrolling in OUIEditableFrame. Likewise, uninhibitMenuFor is called by ancestorScrollViewDidEndScrolling. The assumption this code makes is that each begin scrolling event will be balanced by an end scrolling event. However, this is not the case. Any time the direction of scrolling is changed before scrolling has finished, inhibitMenuFor will be called without a uninhibitMenuFor balancing it out. In these cases the OBASSERT will fail in inhibitMenuFor. No harm done since the inhibitions set will not add an existing object, but likely this assertion should be removed.

- (void)inhibitMenuFor:(NSString *)cause;
{
    DEBUG_MENU(@"%s: %@", __func__, self);
    DEBUG_MENU(@"Inhibiting for: %@", cause);

    OBASSERT([inhibitions member:cause] == nil);
    [inhibitions addObject:cause];
    [self _updateMainMenuVisibility];
}

- (void)uninhibitMenuFor:(NSString *)cause;
{
    DEBUG_MENU(@"%s: %@", __func__, self);
    DEBUG_MENU(@"Overcoming inhibition for: %@", cause);

    OBASSERT([inhibitions member:cause] != nil);
    [inhibitions removeObject:cause];

    [self _updateMainMenuVisibility];
}

[/code]

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