Index: ash/mus/window_manager.cc |
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc |
index a0126dba54709d6cca30f958e72029177a585262..964a1dfeaa85851962ed4bc7231afc88b55bc18e 100644 |
--- a/ash/mus/window_manager.cc |
+++ b/ash/mus/window_manager.cc |
@@ -214,14 +214,16 @@ void WindowManager::OnDidDestroyClient(ui::WindowTreeClient* client) { |
// |root_window_controllers_|. |
DCHECK(root_window_controllers_.empty()); |
+ // Observers can rely on WmShell from the callback. So notify the observers |
+ // before destroying it. |
+ FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
+ OnWindowTreeClientDestroyed()); |
+ |
lookup_.reset(); |
shell_->Shutdown(); |
shell_.reset(); |
shadow_controller_.reset(); |
- FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
- OnWindowTreeClientDestroyed()); |
- |
pointer_watcher_event_router_.reset(); |
window_tree_client_ = nullptr; |