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

Issue 2702163002: bluetooth: Close and null out BluetoothGatt on the UI Thread (Closed)

Created:
3 years, 10 months ago by ortuno
Modified:
3 years, 9 months ago
Reviewers:
scheib
CC:
agrieve+watch_chromium.org, chromium-reviews, ortuno+watch_chromium.org, scheib+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

bluetooth: Close and null out BluetoothGatt on the UI Thread There was a race between posting a task to notify of disconnection and gatt operations: 1. On Bluetooht thread, device disconnects event arrives, nulls mBluetoothGatt and posts a task to the UI thread to notify of disconnection. 2. Before the disconnection task runs on the UI thread, Gatt Operation thinks device is still connected and tries to use mBluetoothGatt. This causes a NullPointerException. Changes OnConnectionStateChanged immediately post to the UI thread. [1] Post a task when sending GATT events http://crrev.com/2708513002 [2.1] Close and null out BluetoothGatt on the UI Thread (This patch). [2.2] Copy characteristic's value before posting task http://crrev.com/2707823002 BUG=691407 Review-Url: https://codereview.chromium.org/2702163002 Cr-Commit-Position: refs/heads/master@{#455038} Committed: https://chromium.googlesource.com/chromium/src/+/1c929fc283a435c85b073e317bfb65c5957a1d81

Patch Set 1 #

Total comments: 2

Patch Set 2 : Make comment more explicit #

Patch Set 3 : Fix test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+187 lines, -17 lines) Patch
M device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java View 1 chunk +18 lines, -17 lines 0 comments Download
M device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc View 1 2 1 chunk +120 lines, -0 lines 0 comments Download
M device/bluetooth/bluetooth_remote_gatt_descriptor_unittest.cc View 1 chunk +49 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 26 (20 generated)
ortuno
jyasskin: PTAL
3 years, 10 months ago (2017-02-21 10:44:52 UTC) #8
ortuno
scheib: PTAL
3 years, 9 months ago (2017-02-27 23:06:38 UTC) #10
scheib
lgtm https://codereview.chromium.org/2702163002/diff/1/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc File device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc (right): https://codereview.chromium.org/2702163002/diff/1/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc#newcode2388 device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc:2388: // Don't run the disconnect task. // Do ...
3 years, 9 months ago (2017-03-04 18:52:25 UTC) #11
ortuno
Thanks! https://codereview.chromium.org/2702163002/diff/1/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc File device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc (right): https://codereview.chromium.org/2702163002/diff/1/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc#newcode2388 device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc:2388: // Don't run the disconnect task. On 2017/03/04 ...
3 years, 9 months ago (2017-03-07 05:06:47 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2702163002/40001
3 years, 9 months ago (2017-03-07 05:28:17 UTC) #23
commit-bot: I haz the power
3 years, 9 months ago (2017-03-07 05:35:24 UTC) #26
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/1c929fc283a435c85b073e317bfb...

Powered by Google App Engine
This is Rietveld 408576698