Skip to content

Commit

Permalink
fix: allocate accelerator on the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
brenca committed Oct 30, 2018
1 parent 7fae6db commit 880b9bb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions atom/browser/api/atom_api_menu.cc
Expand Up @@ -156,10 +156,9 @@ base::string16 Menu::GetSublabelAt(int index) const {
}

base::string16 Menu::GetAcceleratorTextAt(int index) const {
auto* accelerator = new ui::Accelerator();
model_->GetAcceleratorAtWithParams(index, true, accelerator);

return accelerator ? accelerator->GetShortcutText() : base::string16();
ui::Accelerator accelerator;
model_->GetAcceleratorAtWithParams(index, true, &accelerator);
return accelerator.GetShortcutText();
}

bool Menu::IsItemCheckedAt(int index) const {
Expand Down

0 comments on commit 880b9bb

Please sign in to comment.