Skip to content

Commit

Permalink
Merge pull request #57 from luosheng/fix-infinite-loop
Browse files Browse the repository at this point in the history
Workaround for an infinite loop in OS X 10.10.2 (14C94b)
  • Loading branch information
slazyk committed Jan 8, 2015
2 parents 8654e2e + 8dbda41 commit 197b605
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion FuzzyAutocomplete/FuzzyAutocomplete.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ + (void) applicationDidFinishLaunching: (NSNotification *) notification {
}

+ (void) menuDidChange: (NSNotification *) notification {
[[NSNotificationCenter defaultCenter] removeObserver: self
name: NSMenuDidChangeItemNotification
object: nil];

[self createMenuItem];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(menuDidChange:)
name: NSMenuDidChangeItemNotification
object: nil];
}

+ (void)createMenuItem {
Expand All @@ -71,6 +80,7 @@ + (void)createMenuItem {
NSMenuItem * editorMenuItem = [[NSApp mainMenu] itemWithTitle: @"Editor"];

if (editorMenuItem && ![editorMenuItem.submenu itemWithTitle: name]) {

NSMenuItem * fuzzyItem = [[NSMenuItem alloc] initWithTitle: name
action: NULL
keyEquivalent: @""];
Expand All @@ -97,7 +107,6 @@ + (void)createMenuItem {
} else {
[editorMenuItem.submenu insertItem: fuzzyItem atIndex: menuIndex];
}

}
}

Expand Down

0 comments on commit 197b605

Please sign in to comment.