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

Unified Diff: ash/accelerators/accelerator_dispatcher.cc

Issue 9348113: Fix two crash and potential leak&crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert unnecessary file, updated comment Created 8 years, 10 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 | « ash/accelerators/accelerator_dispatcher.h ('k') | ash/accelerators/accelerator_dispatcher_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/accelerators/accelerator_dispatcher.h ('k') | ash/accelerators/accelerator_dispatcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698