Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm

Issue 2347133002: bluetooth: Call error callback when characteristics get destroyed during a GATT Event (mac) (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698