From 0fc0e821f129d064cc1ce92ad71669ffaf005ca2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 12 May 2023 08:36:45 -0700 Subject: [PATCH] QDnsLookup: remove the #if QT_CONFIG(thread) check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no fallback anywhere, so this class simply doesn't work if threading isn't supported. Writing it is an exercise left for whoever cares for that configuration. Change-Id: I3e3bfef633af4130a03afffd175e6f68a3f4673f Reviewed-by: Qt CI Bot Reviewed-by: MÃ¥rten Nordheim --- src/network/configure.cmake | 2 +- src/network/kernel/qdnslookup.cpp | 9 ++------- src/network/kernel/qdnslookup_p.h | 2 -- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/network/configure.cmake b/src/network/configure.cmake index 0fd3a103b26..a26f979d3cf 100644 --- a/src/network/configure.cmake +++ b/src/network/configure.cmake @@ -331,7 +331,7 @@ qt_feature("dnslookup" PUBLIC SECTION "Networking" LABEL "QDnsLookup" PURPOSE "Provides API for DNS lookups." - CONDITION NOT INTEGRITY + CONDITION QT_FEATURE_thread AND NOT INTEGRITY ) qt_feature("gssapi" PUBLIC SECTION "Networking" diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp index 3ad19b0660c..29f0c4928af 100644 --- a/src/network/kernel/qdnslookup.cpp +++ b/src/network/kernel/qdnslookup.cpp @@ -13,9 +13,7 @@ QT_BEGIN_NAMESPACE -#if QT_CONFIG(thread) Q_GLOBAL_STATIC(QDnsLookupThreadPool, theDnsLookupThreadPool); -#endif static bool qt_qdnsmailexchangerecord_less_than(const QDnsMailExchangeRecord &r1, const QDnsMailExchangeRecord &r2) { @@ -476,9 +474,7 @@ void QDnsLookup::lookup() connect(d->runnable, &QDnsLookupRunnable::finished, this, [this](const QDnsLookupReply &reply) { d_func()->_q_lookupFinished(reply); }, Qt::BlockingQueuedConnection); -#if QT_CONFIG(thread) - theDnsLookupThreadPool()->start(d->runnable); -#endif + theDnsLookupThreadPool->start(d->runnable); } /*! @@ -991,7 +987,6 @@ void QDnsLookupRunnable::run() emit finished(reply); } -#if QT_CONFIG(thread) QDnsLookupThreadPool::QDnsLookupThreadPool() : signalsConnected(false) { @@ -1027,7 +1022,7 @@ void QDnsLookupThreadPool::_q_applicationDestroyed() waitForDone(); signalsConnected = false; } -#endif // QT_CONFIG(thread) + QT_END_NAMESPACE #include "moc_qdnslookup.cpp" diff --git a/src/network/kernel/qdnslookup_p.h b/src/network/kernel/qdnslookup_p.h index 3a8e1a53cb1..c1082863cd4 100644 --- a/src/network/kernel/qdnslookup_p.h +++ b/src/network/kernel/qdnslookup_p.h @@ -117,7 +117,6 @@ private: QHostAddress nameserver; }; -#if QT_CONFIG(thread) class QDnsLookupThreadPool : public QThreadPool { Q_OBJECT @@ -133,7 +132,6 @@ private: QMutex signalsMutex; bool signalsConnected; }; -#endif // QT_CONFIG(thread) class QDnsRecordPrivate : public QSharedData {