Browse Source

fix: Linux empty menu model handling (#15605)

* fix: Linux empty menu model handling

* Update root_view.cc
Nitish Sakhawalkar 6 years ago
parent
commit
48ebebcafe
2 changed files with 2 additions and 2 deletions
  1. 0 1
      atom/browser/native_window_views.cc
  2. 2 1
      atom/browser/ui/views/root_view.cc

+ 0 - 1
atom/browser/native_window_views.cc

@@ -894,7 +894,6 @@ void NativeWindowViews::SetMenu(AtomMenuModel* menu_model) {
   if (menu_model == nullptr) {
     global_menu_bar_.reset();
     root_view_->UnregisterAcceleratorsWithFocusManager();
-    return;
   }
 
   if (!global_menu_bar_ && ShouldUseGlobalMenuBar())

+ 2 - 1
atom/browser/ui/views/root_view.cc

@@ -178,9 +178,10 @@ bool RootView::AcceleratorPressed(const ui::Accelerator& accelerator) {
 }
 
 void RootView::RegisterAcceleratorsWithFocusManager(AtomMenuModel* menu_model) {
+  if (!menu_model)
+    return;
   // Clear previous accelerators.
   UnregisterAcceleratorsWithFocusManager();
-
   views::FocusManager* focus_manager = GetFocusManager();
   // Register accelerators with focus manager.
   accelerator_util::GenerateAcceleratorTable(&accelerator_table_, menu_model);