diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-05-01 03:00:31 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-05-01 03:00:31 +0200 |
commit | 43ad63af503bfb6297a31603112b5d510c3faae0 (patch) | |
tree | a2b84e4a1526515ae272c150f8e5c3df9e16f11b /src/android | |
parent | 32e5af2f9322e25ed4e9a61036f48262b8f56ee7 (diff) | |
parent | ef332e4deedc914fe33bab68107f902182e03356 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ia496130e0d71a85670af3ca1cadf81c71d3c2462
Diffstat (limited to 'src/android')
-rw-r--r-- | src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java index 1b527ae3..4063537b 100644 --- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java +++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java @@ -1141,16 +1141,24 @@ public class QtBluetoothLE { if (handle == HANDLE_FOR_MTU_EXCHANGE) return; - GattEntry entry = entries.get(handle); - if (entry == null) - return; - if (entry.valueKnown) - return; - entry.valueKnown = true; + try { + synchronized (this) { - GattEntry serviceEntry = entries.get(entry.associatedServiceHandle); - if (serviceEntry != null && serviceEntry.endHandle == handle) - finishCurrentServiceDiscovery(entry.associatedServiceHandle); + GattEntry entry = entries.get(handle); + if (entry == null) + return; + if (entry.valueKnown) + return; + entry.valueKnown = true; + + GattEntry serviceEntry = entries.get(entry.associatedServiceHandle); + if (serviceEntry != null && serviceEntry.endHandle == handle) + finishCurrentServiceDiscovery(entry.associatedServiceHandle); + } + } catch (IndexOutOfBoundsException outOfBounds) { + Log.w(TAG, "interruptCurrentIO(): Unknown gatt entry, index: " + + handle + " size: " + entries.size()); + } } /* @@ -1271,9 +1279,16 @@ public class QtBluetoothLE { } // last entry of current discovery run? - GattEntry serviceEntry = entries.get(entry.associatedServiceHandle); - if (serviceEntry.endHandle == handle) - finishCurrentServiceDiscovery(entry.associatedServiceHandle); + synchronized (this) { + try { + GattEntry serviceEntry = entries.get(entry.associatedServiceHandle); + if (serviceEntry.endHandle == handle) + finishCurrentServiceDiscovery(entry.associatedServiceHandle); + } catch (IndexOutOfBoundsException outOfBounds) { + Log.w(TAG, "performNextIO(): Unknown service for entry, index: " + + entry.associatedServiceHandle + " size: " + entries.size()); + } + } } else { int errorCode = 0; |