Core/IO/Bluetooth - fix ambiguous conversions

... somewhat prospective fix (I do not have the new iOS yet), so far build
never failed with my current SDK.

Fixes: QTBUG-76847
Change-Id: Iab75c3cd47144cd83b679b1dbf82339e29c07bd1
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Timur Pocheptsov 2019-07-03 15:26:31 +02:00
parent 3394807b3b
commit 0fc7e18bf7
3 changed files with 8 additions and 8 deletions

View File

@ -340,7 +340,7 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data)
- (void)startAdvertising
{
state = PeripheralState::waitingForPowerOn;
if (manager)
if (manager.data())
[manager setDelegate:nil];
manager.reset([[CBPeripheralManager alloc] initWithDelegate:self
queue:OSXBluetooth::qt_LE_queue()]);
@ -405,7 +405,7 @@ bool qt_validate_value_range(const QLowEnergyCharacteristicData &data)
- (void) addServicesToPeripheral
{
Q_ASSERT(manager);
Q_ASSERT(manager.data());
if (nextServiceToAdd < services.size())
[manager addService:services[nextServiceToAdd++]];

View File

@ -132,7 +132,7 @@ QBluetoothDeviceDiscoveryAgentPrivate::QBluetoothDeviceDiscoveryAgentPrivate(con
QBluetoothDeviceDiscoveryAgentPrivate::~QBluetoothDeviceDiscoveryAgentPrivate()
{
if (inquiryLE) {
if (inquiryLE.data()) {
// We want the LE scan to stop as soon as possible.
if (dispatch_queue_t leQueue = OSXBluetooth::qt_LE_queue()) {
// Local variable to be retained ...
@ -151,7 +151,7 @@ bool QBluetoothDeviceDiscoveryAgentPrivate::isActive() const
if (stopPending)
return false;
return inquiryLE;
return !!inquiryLE.data();
}
void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods /*methods*/)
@ -178,7 +178,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
this, &QBluetoothDeviceDiscoveryAgentPrivate::LEdeviceFound);
inquiryLE.reset([[LEDeviceInquiryObjC alloc] initWithNotifier:notifier.data()]);
if (inquiryLE)
if (inquiryLE.data())
notifier.take(); // Whatever happens next, inquiryLE is already the owner ...
dispatch_queue_t leQueue(qt_LE_queue());

View File

@ -165,7 +165,7 @@ QLowEnergyControllerPrivateOSX::QLowEnergyControllerPrivateOSX(QLowEnergyControl
#endif
} else {
centralManager.reset([[ObjCCentralManager alloc] initWith:notifier.data()]);
if (!centralManager) {
if (!centralManager.data()) {
qCWarning(QT_BT_OSX) << "failed to initialize central manager";
return;
}
@ -200,9 +200,9 @@ QLowEnergyControllerPrivateOSX::~QLowEnergyControllerPrivateOSX()
bool QLowEnergyControllerPrivateOSX::isValid() const
{
#ifdef Q_OS_TVOS
return centralManager;
return centralManager.data();
#else
return centralManager || peripheralManager;
return centralManager.data() || peripheralManager.data();
#endif
}