Index: ash/root_window_controller.cc |
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc |
index 3af8f489002c05f1b530354e6ab9b435037b7505..5fa1934d18fc2ce54b53b7df1c3748fafff22ac0 100644 |
--- a/ash/root_window_controller.cc |
+++ b/ash/root_window_controller.cc |
@@ -464,15 +464,20 @@ void RootWindowController::ShowContextMenu( |
if (!menu_model.get()) |
return; |
- views::MenuRunner menu_runner(menu_model.get()); |
- views::Widget* widget = |
- root_window_->GetProperty(kDesktopController)->widget(); |
+ internal::DesktopBackgroundWidgetController* background = |
+ root_window_->GetProperty(kDesktopController); |
+ // Background controller may not be set yet if user clicked on status are |
+ // before initial animation completion. See crbug.com/222218 |
+ if (!background) |
+ return; |
- if (menu_runner.RunMenuAt( |
- widget, NULL, gfx::Rect(location_in_screen, gfx::Size()), |
+ views::MenuRunner menu_runner(menu_model.get()); |
+ if (menu_runner.RunMenuAt(background->widget(), |
+ NULL, gfx::Rect(location_in_screen, gfx::Size()), |
views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == |
- views::MenuRunner::MENU_DELETED) |
+ views::MenuRunner::MENU_DELETED) { |
return; |
+ } |
Shell::GetInstance()->UpdateShelfVisibility(); |
} |