QTlsBackend/QSslSocket - check the arguments we pass to QObject::connect

Not to have warnings about invalid (nullptr) parameters.

Change-Id: I5fdfa7e99df0f3c9907055cf244efa5a56b21c11
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Timur Pocheptsov 2022-01-20 10:52:17 +01:00
parent 4dc977d5ee
commit 9ac323f7cd
2 changed files with 11 additions and 7 deletions

View File

@ -3119,10 +3119,12 @@ QTlsBackend *QSslSocketPrivate::tlsBackendInUse()
}
tlsBackend = QTlsBackend::findBackend(activeBackendName);
QObject::connect(tlsBackend, &QObject::destroyed, [] {
const QMutexLocker locker(&backendMutex);
tlsBackend = nullptr;
});
if (tlsBackend) {
QObject::connect(tlsBackend, &QObject::destroyed, [] {
const QMutexLocker locker(&backendMutex);
tlsBackend = nullptr;
});
}
return tlsBackend;
}

View File

@ -203,9 +203,11 @@ QTlsBackend::QTlsBackend()
if (backends())
backends->addBackend(this);
connect(QCoreApplication::instance(), &QCoreApplication::destroyed, this, [this] {
delete this;
});
if (QCoreApplication::instance()) {
connect(QCoreApplication::instance(), &QCoreApplication::destroyed, this, [this] {
delete this;
});
}
}
/*!