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

Unified Diff: ui/keyboard/keyboard_controller.cc

Issue 527153002: Fix the issue that GetFrameWindow() may change between AddObserver and RemoveObserver in KeyboardCo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « ui/keyboard/keyboard_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_controller.cc
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index ceef5941f7e424a9e912a7ad8ee0f8fe9ff73751..7abfc76d7e884407e5da67b2401e65007c9bbdb7 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -244,6 +244,10 @@ KeyboardController::~KeyboardController() {
if (input_method_)
input_method_->RemoveObserver(this);
ResetWindowInsets();
+
+ for (std::set<aura::Window*>::iterator it = observed_windows_.begin();
+ it != observed_windows_.end(); ++it)
+ (*it)->RemoveObserver(window_bounds_observer_.get());
}
// static
@@ -561,6 +565,7 @@ void KeyboardController::AddBoundsChangedObserver(aura::Window* window) {
if (target_window &&
!target_window->HasObserver(window_bounds_observer_.get())) {
target_window->AddObserver(window_bounds_observer_.get());
+ observed_windows_.insert(target_window);
}
}
@@ -569,6 +574,7 @@ void KeyboardController::RemoveBoundsChangedObserver(aura::Window* window) {
if (target_window &&
target_window->HasObserver(window_bounds_observer_.get())) {
target_window->RemoveObserver(window_bounds_observer_.get());
+ observed_windows_.erase(target_window);
}
}
« no previous file with comments | « ui/keyboard/keyboard_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698