summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2021-12-20 12:20:12 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-07 10:03:14 +0000
commita357b336c7bddab9623154836ae129a495f6e4e3 (patch)
tree9516615dc9113811b988e23803c6d31afac1ebb5
parent0807612a005ecfcff92dc8f9b4469bd92784eab8 (diff)
downloadqtconnectivity-a357b336c7bddab9623154836ae129a495f6e4e3.tar.gz
IOBluetooth: tweak a couple of classes
1. Connection monitor: instead of asserting on 'monitor != nullptr' - issue a warning and bail-out early. Despite of us unregistering from connection notifications and trying to release the monitor, IOBluetooth seems to keep references and sometimes it's possible to trigger this assert in our autotests. 2. IOBluetoothDeviceInquiry - stop reporting errors completely, they are not mapped to any error in QtBluetooth and give nothing but failing auto-tests. Change-Id: I8fc2e23d3685b912759df91c65b02537f39d1b5f Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> (cherry picked from commit ba38f64e22c98ba6b0d3bdccbd00ea5a643404f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/bluetooth/darwin/btconnectionmonitor.mm9
-rw-r--r--src/bluetooth/darwin/btdeviceinquiry.mm6
2 files changed, 12 insertions, 3 deletions
diff --git a/src/bluetooth/darwin/btconnectionmonitor.mm b/src/bluetooth/darwin/btconnectionmonitor.mm
index 548fec9c..a9f038f5 100644
--- a/src/bluetooth/darwin/btconnectionmonitor.mm
+++ b/src/bluetooth/darwin/btconnectionmonitor.mm
@@ -89,6 +89,15 @@ using namespace QT_NAMESPACE;
if (!device)
return;
+ if (!monitor) {
+ // Rather surprising: monitor == nullptr means we stopped monitoring.
+ // So apparently this thingie is still alive and keeps receiving
+ // notifications.
+ qCWarning(QT_BT_DARWIN,
+ "Connection notification received in a monitor that was cancelled");
+ return;
+ }
+
QT_BT_MAC_AUTORELEASEPOOL;
// All Obj-C objects are autoreleased.
diff --git a/src/bluetooth/darwin/btdeviceinquiry.mm b/src/bluetooth/darwin/btdeviceinquiry.mm
index f3e19d88..2d042fd4 100644
--- a/src/bluetooth/darwin/btdeviceinquiry.mm
+++ b/src/bluetooth/darwin/btdeviceinquiry.mm
@@ -159,11 +159,11 @@ const uint8_t IOBlueoothInquiryLengthS = 15;
if (error != kIOReturnSuccess && !aborted) {
// QtBluetooth has not too many error codes, 'UnknownError' is not really
- // useful, report the actual error code here:
+ // useful, log the actual error code here:
qCWarning(QT_BT_DARWIN) << "IOKit error code: " << error;
- m_delegate->error(error);
// Let watchDog to stop it, calling -stop at timeout, otherwise,
- // it looks like inquiry continues and keeps reporting new devices found.
+ // it looks like inquiry continues even after this error and
+ // keeps reporting new devices found.
} else {
// Either a normal completion or from a timer slot.
watchDog.reset();