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
v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  return works_when_hidden_.Run(GetWrapper(), command_id);
}
bool Menu::GetAcceleratorForCommandIdWithParams(
    int command_id,
    bool use_default_accelerator,
    ui::Accelerator* accelerator) const {
  v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  v8::Local<v8::Value> val =
      get_accelerator_.Run(GetWrapper(), command_id, use_default_accelerator);
  return mate::ConvertFromV8(isolate(), val, accelerator);
}
bool Menu::ShouldRegisterAcceleratorForCommandId(int command_id) const {
  v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  return should_register_accelerator_.Run(GetWrapper(), command_id);
}
void Menu::ExecuteCommand(int command_id, int flags) {
  v8::Locker locker(isolate());
  v8::HandleScope handle_scope(isolate());
  execute_command_.Run(GetWrapper(),
                       mate::internal::CreateEventFromFlags(isolate(), flags),
                       command_id);
}
void Menu::OnMenuWillShow(ui::SimpleMenuModel* source) {