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
return model_->GetItemCount();
}
int Menu::GetCommandIdAt(int index) const {
  return model_->GetCommandIdAt(index);
}
base::string16 Menu::GetLabelAt(int index) const {
  return model_->GetLabelAt(index);
}
base::string16 Menu::GetSublabelAt(int index) const {
  return model_->GetSublabelAt(index);
}
base::string16 Menu::GetToolTipAt(int index) const {
  return model_->GetToolTipAt(index);
}
base::string16 Menu::GetAcceleratorTextAt(int index) const {
  ui::Accelerator accelerator;
  model_->GetAcceleratorAtWithParams(index, true, &accelerator);
  return accelerator.GetShortcutText();
}
bool Menu::IsItemCheckedAt(int index) const {
  return model_->IsItemCheckedAt(index);
}
bool Menu::IsEnabledAt(int index) const {
  return model_->IsEnabledAt(index);
}
bool Menu::IsVisibleAt(int index) const {
  return model_->IsVisibleAt(index);
}
bool Menu::WorksWhenHiddenAt(int index) const {