diff --git a/src/network/kernel/qnetworkinformation.cpp b/src/network/kernel/qnetworkinformation.cpp index 0c41a3a42e..d09ed949cc 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 instanceHolder; + std::unique_ptr instanceHolder; QList factories; }; Q_GLOBAL_STATIC(QStaticNetworkInformationDataHolder, dataHolder); diff --git a/src/network/kernel/qnetworkinformation.h b/src/network/kernel/qnetworkinformation.h index 658e152491..6d804fa4ee 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) };