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

Unified Diff: ash/wm/solo_window_tracker_unittest.cc

Issue 101013002: Make sure WindowObservers are removed from window before destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix shutdown order Created 7 years 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/shell.cc ('k') | ash/wm/window_cycle_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/solo_window_tracker_unittest.cc
diff --git a/ash/wm/solo_window_tracker_unittest.cc b/ash/wm/solo_window_tracker_unittest.cc
index a874bb82308c3b02a4955fc270759dddb042c7c9..431ae009556a284fe5b54e2bc280f535353e529f 100644
--- a/ash/wm/solo_window_tracker_unittest.cc
+++ b/ash/wm/solo_window_tracker_unittest.cc
@@ -29,10 +29,14 @@ namespace {
class WindowRepaintChecker : public aura::WindowObserver {
public:
explicit WindowRepaintChecker(aura::Window* window)
- : is_paint_scheduled_(false) {
- window->AddObserver(this);
+ : window_(window),
+ is_paint_scheduled_(false) {
+ window_->AddObserver(this);
}
+
virtual ~WindowRepaintChecker() {
+ if (window_)
+ window_->RemoveObserver(this);
}
bool IsPaintScheduledAndReset() {
@@ -47,10 +51,12 @@ class WindowRepaintChecker : public aura::WindowObserver {
const gfx::Rect& region) OVERRIDE {
is_paint_scheduled_ = true;
}
- virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
- window->RemoveObserver(this);
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {
+ DCHECK_EQ(window_, window);
+ window_ = NULL;
}
+ aura::Window* window_;
bool is_paint_scheduled_;
DISALLOW_COPY_AND_ASSIGN(WindowRepaintChecker);
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/window_cycle_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698