Connect bearer engines to manager with QueuedConnection

This is to avoid a deadlock that happens when a user thread is
accessing the QNetworkConfigurationManager at the same time the
plugin emits a signal.

i.e.
plugin is holding engine lock
user thread is holding manager lock and blocked trying to acquire
the engine lock
In the manager slot, it tries to acquire the manager lock.

By using queued connection, there are no locks held at the time the
manager slot is called.

Change-Id: I95f28028b5e77f77b2b9b7e31cbd1b78a8fe3097
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
bb10
Shane Kearns 2012-04-27 11:31:58 +01:00 committed by Qt by Nokia
parent 9793dbcc4a
commit 55070e8637
1 changed files with 8 additions and 4 deletions

View File

@ -393,13 +393,17 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
engine->moveToThread(bearerThread);
connect(engine, SIGNAL(updateCompleted()),
this, SLOT(updateConfigurations()));
this, SLOT(updateConfigurations()),
Qt::QueuedConnection);
connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer)));
this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer)),
Qt::QueuedConnection);
connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)));
this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)),
Qt::QueuedConnection);
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)));
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)),
Qt::QueuedConnection);
}
}