summaryrefslogtreecommitdiffstats
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
commit759ece64f113cccd93a1c58f770366c84e3093f5 (patch)
treefa4ad7c9aed1dd655d3a3651241c9aea79a31a86
parent3e1f704a71aa160720ee8a5e5fd2f141212d5c2e (diff)
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 db8c778b..536db35d 100644
--- a/src/bluetooth/darwin/btdeviceinquiry.mm
+++ b/src/bluetooth/darwin/btdeviceinquiry.mm
@@ -158,11 +158,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();