summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2021-04-12 16:38:19 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-12 18:58:14 +0000
commit6c00b2e8a42f4a47feb29b2d84a9fb07d7798aa6 (patch)
treeae7c315662c619c0e3f900cf9ecd60d2eaf5b7c5
parente6870c6570203b75d0fcb7ec0ee8ad7ea970bae4 (diff)
QNetworkInformation: Private the destructor
It wasn't meant to be public. Change-Id: Ifa7fff48f82b96bdfa277677d3988dc8881b8c2a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b1fe3e3d80cb23dee4de683e03711d1ac0614de2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/network/kernel/qnetworkinformation.cpp7
-rw-r--r--src/network/kernel/qnetworkinformation.h5
2 files changed, 9 insertions, 3 deletions
diff --git a/src/network/kernel/qnetworkinformation.cpp b/src/network/kernel/qnetworkinformation.cpp
index 1ebe2f6045..6ce572d408 100644
--- a/src/network/kernel/qnetworkinformation.cpp
+++ b/src/network/kernel/qnetworkinformation.cpp
@@ -56,6 +56,11 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcNetInfo)
Q_LOGGING_CATEGORY(lcNetInfo, "qt.network.info");
+struct QNetworkInformationDeleter
+{
+ void operator()(QNetworkInformation *information) { delete information; }
+};
+
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QNetworkInformationBackendFactory_iid,
QStringLiteral("/networkinformationbackends")))
@@ -63,7 +68,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
struct QStaticNetworkInformationDataHolder
{
QMutex instanceMutex;
- std::unique_ptr<QNetworkInformation> instanceHolder;
+ std::unique_ptr<QNetworkInformation, QNetworkInformationDeleter> instanceHolder;
QList<QNetworkInformationBackendFactory *> factories;
};
Q_GLOBAL_STATIC(QStaticNetworkInformationDataHolder, dataHolder);
diff --git a/src/network/kernel/qnetworkinformation.h b/src/network/kernel/qnetworkinformation.h
index 84d29c8a41..07f4fe873d 100644
--- a/src/network/kernel/qnetworkinformation.h
+++ b/src/network/kernel/qnetworkinformation.h
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
class QNetworkInformationBackend;
class QNetworkInformationPrivate;
+struct QNetworkInformationDeleter;
class Q_NETWORK_EXPORT QNetworkInformation : public QObject
{
Q_OBJECT
@@ -70,8 +71,6 @@ public:
Q_DECLARE_FLAGS(Features, Feature)
Q_FLAG(Features)
- ~QNetworkInformation() override;
-
Reachability reachability() const;
QString backendName() const;
@@ -87,8 +86,10 @@ Q_SIGNALS:
void reachabilityChanged(Reachability newReachability);
private:
+ friend struct QNetworkInformationDeleter;
friend class QNetworkInformationPrivate;
QNetworkInformation(QNetworkInformationBackend *backend);
+ ~QNetworkInformation() override;
Q_DISABLE_COPY_MOVE(QNetworkInformation)
};