diff --git a/atom/browser/ui/atom_menu_model.cc b/atom/browser/ui/atom_menu_model.cc index 9add7a22715e..369684dd3f21 100644 --- a/atom/browser/ui/atom_menu_model.cc +++ b/atom/browser/ui/atom_menu_model.cc @@ -17,12 +17,14 @@ AtomMenuModel::~AtomMenuModel() { } void AtomMenuModel::SetRole(int index, const base::string16& role) { - roles_[index] = role; + int command_id = GetCommandIdAt(index); + roles_[command_id] = role; } base::string16 AtomMenuModel::GetRoleAt(int index) { - if (ContainsKey(roles_, index)) - return roles_[index]; + int command_id = GetCommandIdAt(index); + if (ContainsKey(roles_, command_id)) + return roles_[command_id]; else return base::string16(); } diff --git a/atom/browser/ui/atom_menu_model.h b/atom/browser/ui/atom_menu_model.h index d091df9fb570..1112949e7efa 100644 --- a/atom/browser/ui/atom_menu_model.h +++ b/atom/browser/ui/atom_menu_model.h @@ -42,7 +42,7 @@ class AtomMenuModel : public ui::SimpleMenuModel { private: Delegate* delegate_; // weak ref. - std::map roles_; + std::map roles_; // command id -> role base::ObserverList observers_; DISALLOW_COPY_AND_ASSIGN(AtomMenuModel);