diff options
author | emaxx <emaxx@chromium.org> | 2015-10-30 06:18:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-30 13:19:52 +0000 |
commit | b0171a54ebf5185259fbb741d771c573d0934ad7 (patch) | |
tree | b645b98cf264366fa3e62026756ad8af92d45abf /ash | |
parent | f50445a583e4b7f5f4c865a061c83a4d7b57e5c5 (diff) | |
download | chromium_src-b0171a54ebf5185259fbb741d771c573d0934ad7.zip chromium_src-b0171a54ebf5185259fbb741d771c573d0934ad7.tar.gz chromium_src-b0171a54ebf5185259fbb741d771c573d0934ad7.tar.bz2 |
Fix occasional crash in ~VPNListView during shell destruction.
The crash is caused by the fact that during the ash::Shell destruction the
SystemTrayDelegate object is destroyed before the child windows are closed -
but apparently the VPNListView destructor accesses SystemTrayDelegate's members
without any checks.
BUG=542146
TEST=manual testing
Review URL: https://codereview.chromium.org/1410033002
Cr-Commit-Position: refs/heads/master@{#357088}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/system/chromeos/network/vpn_delegate.h | 2 | ||||
-rw-r--r-- | ash/system/chromeos/network/vpn_list_view.cc | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/ash/system/chromeos/network/vpn_delegate.h b/ash/system/chromeos/network/vpn_delegate.h index aaf76a3..fd6fe72 100644 --- a/ash/system/chromeos/network/vpn_delegate.h +++ b/ash/system/chromeos/network/vpn_delegate.h @@ -91,7 +91,7 @@ class ASH_EXPORT VPNDelegate { void NotifyObservers(); private: - base::ObserverList<Observer, true> observer_list_; + base::ObserverList<Observer> observer_list_; DISALLOW_COPY_AND_ASSIGN(VPNDelegate); }; diff --git a/ash/system/chromeos/network/vpn_list_view.cc b/ash/system/chromeos/network/vpn_list_view.cc index d3f3061..a80853b 100644 --- a/ash/system/chromeos/network/vpn_list_view.cc +++ b/ash/system/chromeos/network/vpn_list_view.cc @@ -239,10 +239,14 @@ VPNListView::VPNListView(ui::NetworkListDelegate* delegate) } VPNListView::~VPNListView() { - Shell::GetInstance() - ->system_tray_delegate() - ->GetVPNDelegate() - ->RemoveObserver(this); + // We need the check as on shell destruction, the delegate is destroyed first. + SystemTrayDelegate* const system_tray_delegate = + Shell::GetInstance()->system_tray_delegate(); + if (system_tray_delegate) { + VPNDelegate* const vpn_delegate = system_tray_delegate->GetVPNDelegate(); + if (vpn_delegate) + vpn_delegate->RemoveObserver(this); + } } void VPNListView::Update() { |