Index: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm |
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm |
index ffa4ad601678c1ef63e5d64d42da5f7acea87141..047cb80a9334e2d38d2b9157aec697f5ed32a8ef 100644 |
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm |
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm |
@@ -80,7 +80,18 @@ BluetoothRemoteGattCharacteristicMac::BluetoothRemoteGattCharacteristicMac( |
(void*)cb_characteristic_]); |
} |
-BluetoothRemoteGattCharacteristicMac::~BluetoothRemoteGattCharacteristicMac() {} |
+BluetoothRemoteGattCharacteristicMac::~BluetoothRemoteGattCharacteristicMac() { |
+ if (!read_characteristic_value_callbacks_.first.is_null()) { |
+ std::pair<ValueCallback, ErrorCallback> callbacks; |
+ callbacks.swap(read_characteristic_value_callbacks_); |
+ callbacks.second.Run(BluetoothGattService::GATT_ERROR_FAILED); |
+ } |
+ if (!write_characteristic_value_callbacks_.first.is_null()) { |
+ std::pair<base::Closure, ErrorCallback> callbacks; |
+ callbacks.swap(write_characteristic_value_callbacks_); |
+ callbacks.second.Run(BluetoothGattService::GATT_ERROR_FAILED); |
+ } |
+} |
std::string BluetoothRemoteGattCharacteristicMac::GetIdentifier() const { |
return identifier_; |