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..b6a225076b773188d193a5456aade0bbda2559ee 100644 |
--- a/ash/system/chromeos/network/vpn_list_view.cc |
+++ b/ash/system/chromeos/network/vpn_list_view.cc |
@@ -239,10 +239,11 @@ 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. |
bartfab (slow)
2015/10/16 15:45:25
You are masking a bug here: VPNDelegate expects al
stevenjb
2015/10/16 16:50:07
This is actually correct (but see note below).
*
bartfab (slow)
2015/10/16 16:55:22
VPNDelegate will currently DCHECK() in its destruc
stevenjb
2015/10/16 17:46:18
I see. I think this pattern (without the DCHECK on
emaxx
2015/10/16 17:58:10
Bartosz, first of all, thanks for pointing at the
emaxx
2015/10/16 17:58:10
I think the idea behind the existing code is that
stevenjb
2015/10/16 18:06:40
I'm not sure if that is correct. At one point we s
emaxx
2015/10/28 15:14:38
Done.
|
+ SystemTrayDelegate* const system_tray_delegate = |
+ Shell::GetInstance()->system_tray_delegate(); |
+ if (system_tray_delegate) |
+ system_tray_delegate->GetVPNDelegate()->RemoveObserver(this); |
} |
void VPNListView::Update() { |