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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/accelerators/accelerator_dispatcher.h" 5 #include "ash/accelerators/accelerator_dispatcher.h"
6 6
7 namespace ash { 7 namespace ash {
8 8
9 AcceleratorDispatcher::AcceleratorDispatcher( 9 AcceleratorDispatcher::AcceleratorDispatcher(
10 MessageLoop::Dispatcher* nested_dispatcher, aura::Window* associated_window) 10 MessageLoop::Dispatcher* nested_dispatcher, aura::Window* associated_window)
11 : nested_dispatcher_(nested_dispatcher), 11 : nested_dispatcher_(nested_dispatcher),
12 associated_window_(associated_window) { 12 associated_window_(associated_window) {
13 DCHECK(nested_dispatcher_); 13 DCHECK(nested_dispatcher_);
14 DCHECK(associated_window_); 14 associated_window_->AddObserver(this);
15 }
16
17 AcceleratorDispatcher::~AcceleratorDispatcher() {
18 if (associated_window_)
19 associated_window_->RemoveObserver(this);
20 }
21
22 void AcceleratorDispatcher::OnWindowDestroying(aura::Window* window) {
23 if (associated_window_ == window)
24 associated_window_ = NULL;
15 } 25 }
16 26
17 } // namespace ash 27 } // namespace ash
OLDNEW
« 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