summaryrefslogtreecommitdiffstats
path: root/ui/aura/window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/aura/window.cc')
-rw-r--r--ui/aura/window.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 86c9046..2c9aab8 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -235,6 +235,15 @@ Window::~Window() {
if (host)
host->dispatcher()->OnPostNotifiedWindowDestroying(this);
+ // The window should have already had its state cleaned up in
+ // WindowEventDispatcher::OnWindowHidden(), but there have been some crashes
+ // involving windows being destroyed without being hidden first. See
+ // crbug.com/342040. This should help us debug the issue. TODO(tdresser):
+ // remove this once we determine why we have windows that are destroyed
+ // without being hidden.
+ bool window_incorrectly_cleaned_up = CleanupGestureState();
+ CHECK(!window_incorrectly_cleaned_up);
+
// Then destroy the children.
RemoveOrDestroyChildren();
@@ -1324,6 +1333,19 @@ void Window::OnWindowBoundsChanged(const gfx::Rect& old_bounds) {
OnWindowBoundsChanged(this, old_bounds, bounds()));
}
+bool Window::CleanupGestureState() {
+ bool state_modified = false;
+ state_modified |= ui::GestureRecognizer::Get()->CancelActiveTouches(this);
+ state_modified |=
+ ui::GestureRecognizer::Get()->CleanupStateForConsumer(this);
+ for (Window::Windows::iterator iter = children_.begin();
+ iter != children_.end();
+ ++iter) {
+ state_modified |= (*iter)->CleanupGestureState();
+ }
+ return state_modified;
+}
+
void Window::OnPaintLayer(gfx::Canvas* canvas) {
Paint(canvas);
}