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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc

Issue 1465863003: bluetooth: Fix crash when trying to read or write when operation pending (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address scheib's comments Created 5 years, 1 month 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
« no previous file with comments | « device/bluetooth/bluetooth_gatt_service_unittest.cc ('k') | device/bluetooth/test/bluetooth_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
index 8d5868b5caa368efe8431210acc00a5cf8a39c3b..3e0699e7aa3a8e159d5ce99b90e11f16942218eb 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
@@ -144,7 +144,10 @@ void BluetoothRemoteGattCharacteristicAndroid::ReadRemoteCharacteristic(
const ValueCallback& callback,
const ErrorCallback& error_callback) {
if (read_pending_ || write_pending_) {
- error_callback.Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS);
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(error_callback,
+ BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ return;
}
if (!Java_ChromeBluetoothRemoteGattCharacteristic_readRemoteCharacteristic(
@@ -166,7 +169,10 @@ void BluetoothRemoteGattCharacteristicAndroid::WriteRemoteCharacteristic(
const base::Closure& callback,
const ErrorCallback& error_callback) {
if (read_pending_ || write_pending_) {
- error_callback.Run(BluetoothGattService::GATT_ERROR_IN_PROGRESS);
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(error_callback,
+ BluetoothGattService::GATT_ERROR_IN_PROGRESS));
+ return;
}
JNIEnv* env = AttachCurrentThread();
« no previous file with comments | « device/bluetooth/bluetooth_gatt_service_unittest.cc ('k') | device/bluetooth/test/bluetooth_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698