fix: don't construct submenu if it's invisible (#16834)

This commit is contained in:
Shelley Vohr 2019-02-08 12:54:39 -08:00 committed by Samuel Attard
parent 833daaa2b2
commit 062778c031

View file

@ -220,7 +220,8 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
NSMenu* submenu = [[NSMenu alloc] initWithTitle:label]; NSMenu* submenu = [[NSMenu alloc] initWithTitle:label];
[item setSubmenu:submenu]; [item setSubmenu:submenu];
[NSApp setServicesMenu:submenu]; [NSApp setServicesMenu:submenu];
} else if (type == atom::AtomMenuModel::TYPE_SUBMENU) { } else if (type == atom::AtomMenuModel::TYPE_SUBMENU &&
model->IsVisibleAt(index)) {
// Recursively build a submenu from the sub-model at this index. // Recursively build a submenu from the sub-model at this index.
[item setTarget:nil]; [item setTarget:nil];
[item setAction:nil]; [item setAction:nil];