QTlsBackend: Fix living QObjects after QCoreApplication shutdown
Since switching to the plugin bases system for the tls backends, Qt again retains some QObjects after QCoreApplication shutdown. This was previously fixed in QTBUG-84234, so make sure we destroy the newly introduced QObjects as well. Task-number: QTBUG-84234 Pick-to: 6.3 Change-Id: I1aaea2c90f7d55793c19259be4f9173b4befb246 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
4cc1d81d79
commit
c3c57cb968
|
|
@ -3118,7 +3118,12 @@ QTlsBackend *QSslSocketPrivate::tlsBackendInUse()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return tlsBackend = QTlsBackend::findBackend(activeBackendName);
|
||||
tlsBackend = QTlsBackend::findBackend(activeBackendName);
|
||||
QObject::connect(tlsBackend, &QObject::destroyed, [] {
|
||||
const QMutexLocker locker(&backendMutex);
|
||||
tlsBackend = nullptr;
|
||||
});
|
||||
return tlsBackend;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue