Index: device/bluetooth/bluetooth_adapter_chromeos.cc |
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc |
index e6c628322d349b629b507b17f753d8d541b35955..204bc80debb72aed0ea4da74b3da6cc4c0cf5f2d 100644 |
--- a/device/bluetooth/bluetooth_adapter_chromeos.cc |
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc |
@@ -964,16 +964,15 @@ void BluetoothAdapterChromeOS::UseProfile( |
} |
profiles_[uuid] = BluetoothAdapterProfileChromeOS::Register( |
- this, uuid, options, |
+ this->weak_ptr_factory_.GetWeakPtr(), uuid, options, |
base::Bind(&BluetoothAdapterChromeOS::OnRegisterProfile, this, uuid, |
device_path, delegate, success_callback, error_callback), |
base::Bind(&BluetoothAdapterChromeOS::OnRegisterProfileError, this, uuid, |
error_callback)); |
} |
-void BluetoothAdapterChromeOS::ReleaseProfile(const BluetoothUUID& uuid) { |
+void BluetoothAdapterChromeOS::RemoveProfile(const BluetoothUUID& uuid) { |
if (profiles_.find(uuid) != profiles_.end()) { |
Ilya Sherman
2015/02/19 20:37:58
nit: I don't think you need the if stmt at all any
Marie Janssen
2015/02/20 22:53:46
Done.
|
- delete profiles_[uuid]; |
profiles_.erase(uuid); |
Ilya Sherman
2015/02/19 20:37:58
What code is responsible for freeing the memory fo
Marie Janssen
2015/02/20 22:53:46
Profiles are now owned by BluetoothAdapterChromeOS
|
} |
} |
@@ -1011,8 +1010,8 @@ void BluetoothAdapterChromeOS::OnRegisterProfileError( |
LOG(WARNING) << object_path_.value() |
<< ": Failed to register profile: " << error_name << ": " |
<< error_message; |
+ delete profiles_[uuid]; |
Ilya Sherman
2015/02/19 20:37:58
Are you sure it's appropriate to do this *before*
Marie Janssen
2015/02/20 22:53:46
Sockets don't get this pointer until the RegisterP
|
error_callback.Run(error_message); |
- ReleaseProfile(uuid); |
} |
void BluetoothAdapterChromeOS::OnSetDiscoverable( |