Index: chrome/browser/extensions/api/dial/dial_registry.cc |
diff --git a/chrome/browser/extensions/api/dial/dial_registry.cc b/chrome/browser/extensions/api/dial/dial_registry.cc |
index 3c092bdeee1742acf17179c8ba6810ee9ae31797..f3cbe46ef07475adb6df57c9d42e37b5493ab561 100644 |
--- a/chrome/browser/extensions/api/dial/dial_registry.cc |
+++ b/chrome/browser/extensions/api/dial/dial_registry.cc |
@@ -160,8 +160,11 @@ bool DialRegistry::PruneExpiredDevices() { |
auto* device = it->second; |
if (IsDeviceExpired(*device)) { |
VLOG(2) << "Device " << device->label() << " expired, removing"; |
- const size_t num_erased_by_id = |
- device_by_id_map_.erase(device->device_id()); |
+ |
+ // Make a copy of the device ID here since |device| will be destroyed |
+ // during erase(). |
+ std::string device_id = device->device_id(); |
miu
2016/10/22 18:37:19
nit: Probably not a big deal for performance, but
|
+ const size_t num_erased_by_id = device_by_id_map_.erase(device_id); |
Wez
2016/10/22 00:55:39
As discussed offline... wow, really surprised that
|
DCHECK_EQ(1U, num_erased_by_id); |
device_by_label_map_.erase(it++); |
pruned_device = true; |