Fix crash when app is going to shutdown but conf manager is requested
If the app is finished and going to shutdown, qNetworkConfigurationManagerPrivate() returns nullptr. Change-Id: I01915021d8698802b3a1d0dee43203cd3d4aba74 Task-number: QTBUG-76090 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
93642992ae
commit
9b6928b7cc
@ -233,7 +233,7 @@ QNetworkConfigurationManager::QNetworkConfigurationManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
|
||||
|
||||
if (priv) {
|
||||
connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)),
|
||||
this, SIGNAL(configurationAdded(QNetworkConfiguration)));
|
||||
connect(priv, SIGNAL(configurationRemoved(QNetworkConfiguration)),
|
||||
@ -247,6 +247,7 @@ QNetworkConfigurationManager::QNetworkConfigurationManager(QObject *parent)
|
||||
|
||||
priv->enablePolling();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Frees the resources associated with the QNetworkConfigurationManager object.
|
||||
|
@ -258,7 +258,8 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig,
|
||||
|
||||
// invalid configuration
|
||||
if (!connectionConfig.identifier().isEmpty()) {
|
||||
const auto engines = qNetworkConfigurationManagerPrivate()->engines();
|
||||
auto priv = qNetworkConfigurationManagerPrivate();
|
||||
const auto engines = priv ? priv->engines() : QList<QBearerEngine *>();
|
||||
for (QBearerEngine *engine : engines) {
|
||||
if (engine->hasIdentifier(connectionConfig.identifier())) {
|
||||
d = engine->createSessionBackend();
|
||||
|
@ -56,13 +56,14 @@ QT_BEGIN_NAMESPACE
|
||||
static QBearerEngineImpl *getEngineFromId(const QString &id)
|
||||
{
|
||||
QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
|
||||
|
||||
if (priv) {
|
||||
const auto engines = priv->engines();
|
||||
for (QBearerEngine *engine : engines) {
|
||||
QBearerEngineImpl *engineImpl = qobject_cast<QBearerEngineImpl *>(engine);
|
||||
if (engineImpl && engineImpl->hasIdentifier(id))
|
||||
return engineImpl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user