QtNetwork: Disambiguate static variables

They causes clashes in CMake Unity (Jumbo) builds.

Task-number: QTBUG-109394
Change-Id: Ifd0539c3b56dc395a860de927736f60ad766224a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 25537f5fdc9a19e54ad639bdec80e8a1b5805fdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Friedemann Kleint 2023-01-27 11:46:12 +01:00 committed by Qt Cherry-pick Bot
parent cb9ae6ace2
commit e60a50286c
3 changed files with 12 additions and 12 deletions

View File

@ -77,7 +77,7 @@ Q_APPLICATION_STATIC(QNetworkAccessFileBackendFactory, fileBackend)
Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend) Q_GLOBAL_STATIC(QNetworkAccessDebugPipeBackendFactory, debugpipeBackend)
#endif #endif
Q_APPLICATION_STATIC(QFactoryLoader, loader, QNetworkAccessBackendFactory_iid, "/networkaccess"_L1) Q_APPLICATION_STATIC(QFactoryLoader, qnabfLoader, QNetworkAccessBackendFactory_iid, "/networkaccess"_L1)
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
bool getProxyAuth(const QString& proxyHostname, const QString &scheme, QString& username, QString& password) bool getProxyAuth(const QString& proxyHostname, const QString &scheme, QString& username, QString& password)
@ -1703,13 +1703,13 @@ void QNetworkAccessManagerPrivate::ensureBackendPluginsLoaded()
{ {
Q_CONSTINIT static QBasicMutex mutex; Q_CONSTINIT static QBasicMutex mutex;
std::unique_lock locker(mutex); std::unique_lock locker(mutex);
if (!loader()) if (!qnabfLoader())
return; return;
#if QT_CONFIG(library) #if QT_CONFIG(library)
loader->update(); qnabfLoader->update();
#endif #endif
int index = 0; int index = 0;
while (loader->instance(index)) while (qnabfLoader->instance(index))
++index; ++index;
} }

View File

@ -26,7 +26,7 @@ struct QNetworkInformationDeleter
void operator()(QNetworkInformation *information) { delete information; } void operator()(QNetworkInformation *information) { delete information; }
}; };
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, qniLoader,
(QNetworkInformationBackendFactory_iid, (QNetworkInformationBackendFactory_iid,
QStringLiteral("/networkinformation"))) QStringLiteral("/networkinformation")))
@ -84,7 +84,7 @@ private:
bool QNetworkInformationPrivate::initializeList() bool QNetworkInformationPrivate::initializeList()
{ {
if (!loader()) if (!qniLoader())
return false; return false;
if (!dataHolder()) if (!dataHolder())
return false; return false;
@ -92,11 +92,11 @@ bool QNetworkInformationPrivate::initializeList()
QMutexLocker initLocker(&mutex); QMutexLocker initLocker(&mutex);
#if QT_CONFIG(library) #if QT_CONFIG(library)
loader->update(); qniLoader->update();
#endif #endif
// Instantiates the plugins (and registers the factories) // Instantiates the plugins (and registers the factories)
int index = 0; int index = 0;
while (loader->instance(index)) while (qniLoader->instance(index))
++index; ++index;
initLocker.unlock(); initLocker.unlock();

View File

@ -27,7 +27,7 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals; using namespace Qt::StringLiterals;
Q_APPLICATION_STATIC(QFactoryLoader, loader, QTlsBackend_iid, Q_APPLICATION_STATIC(QFactoryLoader, qtlsbLoader, QTlsBackend_iid,
QStringLiteral("/tls")) QStringLiteral("/tls"))
namespace { namespace {
@ -54,7 +54,7 @@ public:
bool tryPopulateCollection() bool tryPopulateCollection()
{ {
if (!loader()) if (!qtlsbLoader())
return false; return false;
Q_CONSTINIT static QBasicMutex mutex; Q_CONSTINIT static QBasicMutex mutex;
@ -63,10 +63,10 @@ public:
return true; return true;
#if QT_CONFIG(library) #if QT_CONFIG(library)
loader->update(); qtlsbLoader->update();
#endif #endif
int index = 0; int index = 0;
while (loader->instance(index)) while (qtlsbLoader->instance(index))
++index; ++index;
return true; return true;