Index: chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc |
diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc |
index 2dcc91cc0298313ad383637e693e7d2deebbfc9b..6ad2c2fe1ad2c323875f5dad6db4e763273f89f6 100644 |
--- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc |
+++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc |
@@ -104,7 +104,7 @@ SignedInDevicesManager::SignedInDevicesManager() |
SignedInDevicesManager::SignedInDevicesManager(content::BrowserContext* context) |
: profile_(Profile::FromBrowserContext(context)), |
extension_registry_observer_(this) { |
- extensions::EventRouter* router = extensions::EventRouter::Get(profile_); |
+ EventRouter* router = EventRouter::Get(profile_); |
if (router) { |
router->RegisterObserver( |
this, api::signed_in_devices::OnDeviceInfoChange::kEventName); |
@@ -115,7 +115,13 @@ SignedInDevicesManager::SignedInDevicesManager(content::BrowserContext* context) |
extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
} |
-SignedInDevicesManager::~SignedInDevicesManager() {} |
+SignedInDevicesManager::~SignedInDevicesManager() { |
+ if (profile_) { |
+ EventRouter* router = EventRouter::Get(profile_); |
+ if (router) |
+ router->UnregisterObserver(this); |
+ } |
+} |
void SignedInDevicesManager::OnListenerAdded( |
const EventListenerInfo& details) { |