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

Unified Diff: ash/system/chromeos/network/vpn_list_view.cc

Issue 1410033002: Fix occasional crash in ~VPNListView during shell destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable DCHECK in VPNDelegate; handle possible non-existence of VPNDelegate during VPNListView dest… Created 5 years, 2 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/chromeos/network/vpn_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/chromeos/network/vpn_list_view.cc
diff --git a/ash/system/chromeos/network/vpn_list_view.cc b/ash/system/chromeos/network/vpn_list_view.cc
index d3f30613c085ba7b6079b9e7bc15a2eec37edabd..a80853bc2cec4196b3521dc92a3dd954d57c3943 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() {
« no previous file with comments | « ash/system/chromeos/network/vpn_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698