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

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: 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..1aae81dd6bfde73471ed56e085012cedba6075d4 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -464,15 +464,19 @@ void RootWindowController::ShowContextMenu(
if (!menu_model.get())
return;
- views::MenuRunner menu_runner(menu_model.get());
- views::Widget* widget =
- root_window_->GetProperty(kDesktopController)->widget();
-
- if (menu_runner.RunMenuAt(
- widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
- views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
- views::MenuRunner::MENU_DELETED)
+ internal::DesktopBackgroundWidgetController* background =
+ root_window_->GetProperty(kDesktopController);
+ views::Widget* widget = background ? background->widget() : NULL;
oshima 2013/04/03 15:14:12 when it can become null?
Dmitry Polukhin 2013/04/03 18:50:00 I wasn't able to reproduce this crash but you can
+ if (widget) {
+ views::MenuRunner menu_runner(menu_model.get());
+ if (menu_runner.RunMenuAt(
+ widget, NULL, gfx::Rect(location_in_screen, gfx::Size()),
+ views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) ==
+ views::MenuRunner::MENU_DELETED)
+ return;
+ } else {
return;
+ }
oshima 2013/04/03 15:14:12 if (!widget) return; if (menu_runner.RunMenuAt(.
Dmitry Polukhin 2013/04/03 18:50:00 Done.
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