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

Unified Diff: ui/views/focus/focus_manager.cc

Issue 2047083002: Do not allow NULL to be passed into FocusManager::ViewRemoved. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reduce diff Created 4 years, 6 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 | « no previous file | ui/views/widget/widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager.cc
diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc
index bd6b0dc19fe4749a958afe41f8c49dd158ed446a..c65fa84199112981a7331fa27060bd10966c13a9 100644
--- a/ui/views/focus/focus_manager.cc
+++ b/ui/views/focus/focus_manager.cc
@@ -517,7 +517,10 @@ void FocusManager::ViewRemoved(View* removed) {
// clear the focus. However, it's not safe to call ClearFocus()
// (and in turn ClearNativeFocus()) here because ViewRemoved() can
// be called while the top level widget is being destroyed.
- if (focused_view_ && removed->Contains(focused_view_))
+ if (!focused_view_)
sky 2016/06/09 17:23:14 Contains handles null correctly, so you shouldn't
krasin 2016/06/09 17:46:11 I need an early exit, if ViewRemoved is called wit
sky 2016/06/09 18:06:00 Not sure I follow. If focused_view_ is null Contai
krasin 2016/06/09 18:13:06 Consider the case, when removed == NULL. We have t
sky 2016/06/09 22:34:24 removed == null is an error in the call sites and
krasin 2016/06/09 23:10:57 I have tried that. Multiple (almost all) tests are
+ return;
+ DCHECK(removed != NULL);
sky 2016/06/09 17:23:14 DCHECK(removed);
krasin 2016/06/09 17:46:11 Done.
+ if (removed->Contains(focused_view_))
SetFocusedView(NULL);
}
« no previous file with comments | « no previous file | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698