summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qtlsbackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/ssl/qtlsbackend.cpp')
-rw-r--r--src/network/ssl/qtlsbackend.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/network/ssl/qtlsbackend.cpp b/src/network/ssl/qtlsbackend.cpp
index b7d288dfa36..f119caa245f 100644
--- a/src/network/ssl/qtlsbackend.cpp
+++ b/src/network/ssl/qtlsbackend.cpp
@@ -52,6 +52,7 @@
#include <QtCore/private/qfactoryloader_p.h>
+#include "QtCore/qapplicationstatic.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmutex.h>
@@ -60,8 +61,8 @@
QT_BEGIN_NAMESPACE
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QTlsBackend_iid, QStringLiteral("/tls")))
+Q_APPLICATION_STATIC(QFactoryLoader, loader, QTlsBackend_iid,
+ QStringLiteral("/tls"))
namespace {
@@ -92,7 +93,7 @@ public:
static QBasicMutex mutex;
const QMutexLocker locker(&mutex);
- if (loaded)
+ if (backends.size())
return true;
#if QT_CONFIG(library)
@@ -102,7 +103,7 @@ public:
while (loader->instance(index))
++index;
- return loaded = true;
+ return true;
}
QList<QString> backendNames()
@@ -139,7 +140,6 @@ public:
private:
std::vector<QTlsBackend *> backends;
QMutex collectionMutex;
- bool loaded = false;
};
} // Unnamed namespace
@@ -202,6 +202,10 @@ QTlsBackend::QTlsBackend()
{
if (backends())
backends->addBackend(this);
+
+ connect(QCoreApplication::instance(), &QCoreApplication::destroyed, this, [this] {
+ delete this;
+ });
}
/*!