summaryrefslogtreecommitdiffstats
path: root/ash/accelerators/accelerator_dispatcher.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 04:07:57 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 04:07:57 +0000
commitb5dead81ae7c9324772755a14153258083c8aacb (patch)
tree404528b1c9c6012523aa43610996304e10f8b2b0 /ash/accelerators/accelerator_dispatcher.cc
parenta11c5b6f8af29722d014f94d86ac0e4559b1f8f4 (diff)
downloadchromium_src-b5dead81ae7c9324772755a14153258083c8aacb.zip
chromium_src-b5dead81ae7c9324772755a14153258083c8aacb.tar.gz
chromium_src-b5dead81ae7c9324772755a14153258083c8aacb.tar.bz2
Fix two crash and potential leak&crash
* closing window while menu is open This only fix part of this. There is another place that crashes and i'll address it in separate CL. * closing window while modal dialog is open * release resources early and use window::Close in BallonViewImpl This was causing crash if the widget gets closed earlier than DelayedClose task is executed. BUG=114123 TEST=none Review URL: http://codereview.chromium.org/9348113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/accelerators/accelerator_dispatcher.cc')
-rw-r--r--ash/accelerators/accelerator_dispatcher.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/ash/accelerators/accelerator_dispatcher.cc b/ash/accelerators/accelerator_dispatcher.cc
index c72fdc2..47dde9c 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