Javascript's garbage collector destroys popup menus created by menu.popup from api Menu even when they are still active. It can lead to a crash when during destruction phase (when js object is already destroyed but c++ instance of class electron::api::Menu still lives) user makes any interaction with it, like changing focused element.
shell/browser/api/atom_api_menu.cc
mate::Dictionary wrappable(isolate, GetWrapper());
  mate::Dictionary delegate;
  if (!wrappable.Get("delegate", &delegate))
    return;
  delegate.Get("isCommandIdChecked", &is_checked_);
  delegate.Get("isCommandIdEnabled", &is_enabled_);
  delegate.Get("isCommandIdVisible", &is_visible_);
  delegate.Get("shouldCommandIdWorkWhenHidden", &works_when_hidden_);
  delegate.Get("getAcceleratorForCommandId", &get_accelerator_);
  delegate.Get("shouldRegisterAcceleratorForCommandId",
               &should_register_accelerator_);
  delegate.Get("executeCommand", &execute_command_);
  delegate.Get("menuWillShow", &menu_will_show_);
}
bool Menu::IsCommandIdChecked(int command_id) const {
  v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  return is_checked_.Run(GetWrapper(), command_id);
}
bool Menu::IsCommandIdEnabled(int command_id) const {
  v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  return is_enabled_.Run(GetWrapper(), command_id);
}
bool Menu::IsCommandIdVisible(int command_id) const {
  v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  return is_visible_.Run(GetWrapper(), command_id);
}
bool Menu::ShouldCommandIdWorkWhenHidden(int command_id) const {