summaryrefslogtreecommitdiffstats
path: root/ui/views/view.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 20:57:49 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-18 20:57:49 +0000
commit3826023a0c96dce864074d6e9a39685d9c257fde (patch)
treed755e2fae910e17aaefe60a1993d3521af27a04f /ui/views/view.cc
parent747c3065606eecc478bdae6812171345077b37fb (diff)
downloadchromium_src-3826023a0c96dce864074d6e9a39685d9c257fde.zip
chromium_src-3826023a0c96dce864074d6e9a39685d9c257fde.tar.gz
chromium_src-3826023a0c96dce864074d6e9a39685d9c257fde.tar.bz2
Adds debugging code to help figure out a crash. It appears that after
View::OnFocus invokes FocusManager::ClearNativeFocus() the view is being removed from the widget so that the next call (GetWidget()->Notify...) crashes since GetWidget() returns NULL. While I could liking make this code deal with this situation that a View is being removed from a widget when it is getting focus is likely indicative of another problem that is worth understanding. BUG=166355 TEST=none R=oshima@chromium.org Review URL: https://codereview.chromium.org/11573068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/view.cc')
-rw-r--r--ui/views/view.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/ui/views/view.cc b/ui/views/view.cc
index a38ccb7..8914847 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -126,7 +126,8 @@ View::View()
focusable_(false),
accessibility_focusable_(false),
context_menu_controller_(NULL),
- drag_controller_(NULL) {
+ drag_controller_(NULL),
+ in_on_focus_(false) {
}
View::~View() {
@@ -1327,8 +1328,11 @@ void View::OnFocus() {
// By default, we clear the native focus. This ensures that no visible native
// view as the focus and that we still receive keyboard inputs.
FocusManager* focus_manager = GetFocusManager();
- if (focus_manager)
+ if (focus_manager) {
+ in_on_focus_ = true;
focus_manager->ClearNativeFocus();
+ in_on_focus_ = false;
+ }
// TODO(beng): Investigate whether it's possible for us to move this to
// Focus().
@@ -1592,6 +1596,8 @@ void View::DoRemoveChildView(View* view,
}
void View::PropagateRemoveNotifications(View* parent) {
+ CHECK(!in_on_focus_);
+
for (int i = 0, count = child_count(); i < count; ++i)
child_at(i)->PropagateRemoveNotifications(parent);