diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2022-05-30 12:52:04 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2022-05-31 09:14:45 +0300 |
commit | 1a7459b26bd4c65ff09f6665b2aeac712ab59dd1 (patch) | |
tree | e79b79f77283bdb6d7dd168614e5e6f716e271fb /src | |
parent | e24f99cc1dc3fa4e8131e590b0663695c4f81b63 (diff) |
Remove QScopedPointer related deprecation warnings on macOS
The QScopedPointer::take() has been deprecated since Qt 6.1 and the
suggestion is to use std::unique_ptr instead.
Pick-to: 6.2 6.3
Fixes: QTBUG-103826
Change-Id: If40b1dd82f231b07607d1a6bfc6c06e7d3b055e7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm | 15 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothserver_macos.mm | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_macos.mm | 1 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_darwin.mm | 10 |
4 files changed, 14 insertions, 17 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm b/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm index 46c76dc2..3335d5b6 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_darwin.mm @@ -60,7 +60,6 @@ #include "qbluetoothuuid.h" #include <QtCore/qloggingcategory.h> -#include <QtCore/qscopedpointer.h> #include <QtCore/qvector.h> #include <QtCore/qglobal.h> #include <QtCore/qstring.h> @@ -254,24 +253,24 @@ void QBluetoothDeviceDiscoveryAgentPrivate::startLE() using namespace DarwinBluetooth; - QScopedPointer<LECBManagerNotifier> notifier(new LECBManagerNotifier); + std::unique_ptr<LECBManagerNotifier> notifier = std::make_unique<LECBManagerNotifier>(); // Connections: using ErrMemFunPtr = void (LECBManagerNotifier::*)(QBluetoothDeviceDiscoveryAgent::Error); - notifier->connect(notifier.data(), ErrMemFunPtr(&LECBManagerNotifier::CBManagerError), + notifier->connect(notifier.get(), ErrMemFunPtr(&LECBManagerNotifier::CBManagerError), this, &QBluetoothDeviceDiscoveryAgentPrivate::LEinquiryError); - notifier->connect(notifier.data(), &LECBManagerNotifier::LEnotSupported, + notifier->connect(notifier.get(), &LECBManagerNotifier::LEnotSupported, this, &QBluetoothDeviceDiscoveryAgentPrivate::LEnotSupported); - notifier->connect(notifier.data(), &LECBManagerNotifier::discoveryFinished, + notifier->connect(notifier.get(), &LECBManagerNotifier::discoveryFinished, this, &QBluetoothDeviceDiscoveryAgentPrivate::LEinquiryFinished); using DeviceMemFunPtr = void (QBluetoothDeviceDiscoveryAgentPrivate::*)(const QBluetoothDeviceInfo &); - notifier->connect(notifier.data(), &LECBManagerNotifier::deviceDiscovered, + notifier->connect(notifier.get(), &LECBManagerNotifier::deviceDiscovered, this, DeviceMemFunPtr(&QBluetoothDeviceDiscoveryAgentPrivate::deviceFound)); // Check queue and create scanner: - inquiryLE.reset([[LEInquiryObjC alloc] initWithNotifier:notifier.data()], + inquiryLE.reset([[LEInquiryObjC alloc] initWithNotifier:notifier.get()], DarwinBluetooth::RetainPolicy::noInitialRetain); if (inquiryLE) - notifier.take(); // Whatever happens next, inquiryLE is already the owner ... + notifier.release(); // Whatever happens next, inquiryLE is already the owner ... dispatch_queue_t leQueue(qt_LE_queue()); if (!leQueue || !inquiryLE) { diff --git a/src/bluetooth/qbluetoothserver_macos.mm b/src/bluetooth/qbluetoothserver_macos.mm index c98376a8..6d8adce1 100644 --- a/src/bluetooth/qbluetoothserver_macos.mm +++ b/src/bluetooth/qbluetoothserver_macos.mm @@ -52,7 +52,6 @@ #include "qbluetoothsocket.h" #include <QtCore/qloggingcategory.h> -#include <QtCore/qscopedpointer.h> #include <QtCore/qvariant.h> #include <QtCore/qglobal.h> #include <QtCore/qmutex.h> @@ -379,7 +378,7 @@ QBluetoothSocket *QBluetoothServer::nextPendingConnection() if (!d_ptr->pendingConnections.size()) return nullptr; - QScopedPointer<QBluetoothSocket> newSocket(new QBluetoothSocket); + std::unique_ptr<QBluetoothSocket> newSocket = std::make_unique<QBluetoothSocket>(); QBluetoothServerPrivate::PendingConnection channel(d_ptr->pendingConnections.front()); // Remove it even if we have some errors below. @@ -393,7 +392,7 @@ QBluetoothSocket *QBluetoothServer::nextPendingConnection() return nullptr; } - return newSocket.take(); + return newSocket.release(); } QBluetoothAddress QBluetoothServer::serverAddress() const diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm b/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm index 8aaf3b51..9b662e1f 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm +++ b/src/bluetooth/qbluetoothservicediscoveryagent_macos.mm @@ -48,7 +48,6 @@ #include <QtCore/qoperatingsystemversion.h> #include <QtCore/qloggingcategory.h> -#include <QtCore/qscopedpointer.h> #include <QtCore/qstring.h> #include <QtCore/qglobal.h> #include <QtCore/qdebug.h> diff --git a/src/bluetooth/qlowenergycontroller_darwin.mm b/src/bluetooth/qlowenergycontroller_darwin.mm index 224f4f8e..3d6f19b4 100644 --- a/src/bluetooth/qlowenergycontroller_darwin.mm +++ b/src/bluetooth/qlowenergycontroller_darwin.mm @@ -174,10 +174,10 @@ void QLowEnergyControllerPrivateDarwin::init() return; } - QScopedPointer<LECBManagerNotifier> notifier(new LECBManagerNotifier); + std::unique_ptr<LECBManagerNotifier> notifier = std::make_unique<LECBManagerNotifier>(); if (role == QLowEnergyController::PeripheralRole) { #ifndef Q_OS_TVOS - peripheralManager.reset([[ObjCPeripheralManager alloc] initWith:notifier.data()], + peripheralManager.reset([[ObjCPeripheralManager alloc] initWith:notifier.get()], DarwinBluetooth::RetainPolicy::noInitialRetain); if (!peripheralManager) { qCWarning(QT_BT_DARWIN) << "failed to create a peripheral manager"; @@ -188,7 +188,7 @@ void QLowEnergyControllerPrivateDarwin::init() return; #endif // Q_OS_TVOS } else { - centralManager.reset([[ObjCCentralManager alloc] initWith:notifier.data()], + centralManager.reset([[ObjCCentralManager alloc] initWith:notifier.get()], DarwinBluetooth::RetainPolicy::noInitialRetain); if (!centralManager) { qCWarning(QT_BT_DARWIN) << "failed to initialize a central manager"; @@ -196,11 +196,11 @@ void QLowEnergyControllerPrivateDarwin::init() } } - if (!connectSlots(notifier.data())) + if (!connectSlots(notifier.get())) qCWarning(QT_BT_DARWIN) << "failed to connect to notifier's signal(s)"; // Ownership was taken by central manager. - notifier.take(); + notifier.release(); } void QLowEnergyControllerPrivateDarwin::connectToDevice() |