views: Don't retain MenuRunner on heap.
Sometimes the MenuHost would crash when the window is closed, the author didn't recommend using MenuRunner on stack, but since we always run the menu synchronously, this is no problem.
This commit is contained in:
parent
1a79093378
commit
21949e2f0c
4 changed files with 6 additions and 18 deletions
|
@ -25,16 +25,14 @@ void MenuViews::Popup(Window* window) {
|
|||
cursor = gfx::win::ScreenToDIPPoint(cursor);
|
||||
#endif
|
||||
|
||||
menu_runner_.reset(new views::MenuRunner(model()));
|
||||
views::MenuRunner::RunResult result = menu_runner_->RunMenuAt(
|
||||
views::MenuRunner menu_runner(model());
|
||||
ignore_result(menu_runner.RunMenuAt(
|
||||
static_cast<NativeWindowViews*>(window->window())->widget(),
|
||||
NULL,
|
||||
gfx::Rect(cursor, gfx::Size()),
|
||||
views::MenuItemView::TOPLEFT,
|
||||
ui::MENU_SOURCE_MOUSE,
|
||||
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU);
|
||||
if (result == views::MenuRunner::MENU_DELETED)
|
||||
LOG(ERROR) << "Menu deleted when running";
|
||||
views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue