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

Unified Diff: ash/system/user/user_view.cc

Issue 372373002: Fixing notification message crash on fast dismissal click (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « ash/system/user/user_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/user/user_view.cc
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc
index 27fc5fd4cb559f14090279dd0d999438fb58a0c8..4bb872346b5b7ad65f7f65b6dbc44d948e881ff0 100644
--- a/ash/system/user/user_view.cc
+++ b/ash/system/user/user_view.cc
@@ -211,7 +211,8 @@ UserView::UserView(SystemTrayItem* owner,
is_user_card_button_(false),
logout_button_(NULL),
add_user_disabled_(false),
- for_detailed_view_(for_detailed_view) {
+ for_detailed_view_(for_detailed_view),
+ focus_manager_(NULL) {
CHECK_NE(user::LOGGED_IN_NONE, login);
if (!index) {
// Only the logged in user will have a background. All other users will have
@@ -533,15 +534,19 @@ void UserView::ToggleAddUserMenuOption() {
new views::MouseWatcher(new UserViewMouseWatcherHost(area), this));
mouse_watcher_->Start();
// Install a listener to focus changes so that we can remove the card when
- // the focus gets changed.
- user_card_view_->GetFocusManager()->AddFocusChangeListener(this);
+ // the focus gets changed. When called through the destruction of the bubble,
+ // the FocusManager cannot be determined anymore and we remember it here.
+ focus_manager_ = user_card_view_->GetFocusManager();
+ focus_manager_->AddFocusChangeListener(this);
}
void UserView::RemoveAddUserMenuOption() {
if (!add_menu_option_.get())
return;
- user_card_view_->GetFocusManager()->RemoveFocusChangeListener(this);
- user_card_view_->GetFocusManager()->ClearFocus();
+ focus_manager_->RemoveFocusChangeListener(this);
+ focus_manager_ = NULL;
+ if (user_card_view_->GetFocusManager())
+ user_card_view_->GetFocusManager()->ClearFocus();
popup_message_.reset();
mouse_watcher_.reset();
add_menu_option_.reset();
« no previous file with comments | « ash/system/user/user_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698