Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: ash/root_window_controller.cc

Issue 13434005: Prevent crash when desktop controller is NULL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comment Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698