Index: ash/root_window_controller.cc |
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc |
index 9854d36a909a684c052bf5dcf9fd415781b5e1ad..27f0a0144d48736b8a5c70a49245e94c768a8636 100644 |
--- a/ash/root_window_controller.cc |
+++ b/ash/root_window_controller.cc |
@@ -271,12 +271,17 @@ void RootWindowController::Shutdown() { |
wallpaper_controller_.reset(); |
animating_wallpaper_controller_.reset(); |
- CloseChildWindows(); |
+ // Change the active root window before closing child windows. If any child |
+ // being removed triggers a relayout of the shelf it will try to build a |
+ // window list adding windows from the active root window's containers which |
+ // may have already gone away. |
if (Shell::GetActiveRootWindow() == root_window_) { |
Shell::GetInstance()->set_active_root_window( |
Shell::GetPrimaryRootWindow() == root_window_.get() ? |
NULL : Shell::GetPrimaryRootWindow()); |
} |
+ |
+ CloseChildWindows(); |
SetRootWindowController(root_window_.get(), NULL); |
screen_dimmer_.reset(); |
workspace_controller_.reset(); |