diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-19 09:30:57 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-19 09:30:57 +0000 |
commit | 96083ba7da51ea30bd5fb2b317643af77ad1eac5 (patch) | |
tree | 6ea73551cd443663cbbb6484b343f541c42dc4e7 /ui | |
parent | 8f5fc718853a128dc2f70ec4e55db4044af64bcc (diff) | |
download | chromium_src-96083ba7da51ea30bd5fb2b317643af77ad1eac5.zip chromium_src-96083ba7da51ea30bd5fb2b317643af77ad1eac5.tar.gz chromium_src-96083ba7da51ea30bd5fb2b317643af77ad1eac5.tar.bz2 |
Hide the view which is removed from its parent.
Sometimes the view can receive some events after the remove but before really
deleted and it's not safe because the view does not belong to the root window
in the meantime.
In this specific test, the JS test code shows infobar and immediately creates
a new tab, so UpdateRect of the infobar contents and removing of the infobar
happen at the almost same time. If the event happens in the order of
RemoveFromWidget() -> UpdateRect -> delete, the UpdateRect will cause a crash.
BUG=105177
TEST=passed locally
Review URL: http://codereview.chromium.org/9253003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/native/native_view_host_aura.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc index c27dfb4..331a728 100644 --- a/ui/views/controls/native/native_view_host_aura.cc +++ b/ui/views/controls/native/native_view_host_aura.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -53,8 +53,11 @@ void NativeViewHostAura::AddedToWidget() { } void NativeViewHostAura::RemovedFromWidget() { - if (host_->native_view() && host_->native_view()->parent()) - host_->native_view()->parent()->RemoveChild(host_->native_view()); + if (host_->native_view()) { + host_->native_view()->Hide(); + if (host_->native_view()->parent()) + host_->native_view()->parent()->RemoveChild(host_->native_view()); + } } void NativeViewHostAura::InstallClip(int x, int y, int w, int h) { |