From 55070e863710d49dd4b09903be9a85ea94dff1fe Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 27 Apr 2012 11:31:58 +0100 Subject: [PATCH] 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 --- src/network/bearer/qnetworkconfigmanager_p.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index d152adc..527e550 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -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); } } -- 2.7.4