Index: ash/accelerators/accelerator_dispatcher.cc |
diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc |
index c72fdc2429f6abdcae1501472b43ea091f777abb..47dde9c4a6ceb726895d4032ad99ac558093e88f 100644 |
--- a/ash/accelerators/accelerator_dispatcher.cc |
+++ b/ash/accelerators/accelerator_dispatcher.cc |
@@ -11,7 +11,17 @@ AcceleratorDispatcher::AcceleratorDispatcher( |
: nested_dispatcher_(nested_dispatcher), |
associated_window_(associated_window) { |
DCHECK(nested_dispatcher_); |
- DCHECK(associated_window_); |
+ associated_window_->AddObserver(this); |
+} |
+ |
+AcceleratorDispatcher::~AcceleratorDispatcher() { |
+ if (associated_window_) |
+ associated_window_->RemoveObserver(this); |
+} |
+ |
+void AcceleratorDispatcher::OnWindowDestroying(aura::Window* window) { |
+ if (associated_window_ == window) |
+ associated_window_ = NULL; |
} |
} // namespace ash |