summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/generic/qgenericengine.cpp
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-22 01:23:24 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-22 01:42:03 (GMT)
commita56597916b275a2f0d2e3b9f8ac3653eeb4e2e91 (patch)
treeb1bfe41a9bd2b0569e1df9fcd662b95272c6156e /src/plugins/bearer/generic/qgenericengine.cpp
parent0109df3ee449767c1836ec7028ac219c57cf9ca7 (diff)
downloadQt-a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91.zip
Qt-a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91.tar.gz
Qt-a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91.tar.bz2
Add locking to bearer code.
QNetworkConfigurationManagerPrivate and QBearerEngine derived classes need to be thread-safe.
Diffstat (limited to 'src/plugins/bearer/generic/qgenericengine.cpp')
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index dba2c08..a95b14b 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -154,11 +154,15 @@ QGenericEngine::~QGenericEngine()
QString QGenericEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.value(id);
}
bool QGenericEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.contains(id);
}
@@ -174,12 +178,16 @@ void QGenericEngine::disconnectFromId(const QString &id)
void QGenericEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
pollTimer.stop();
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
}
void QGenericEngine::doRequestUpdate()
{
+ QMutexLocker locker(&mutex);
+
// Immediately after connecting with a wireless access point
// QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a
// second time results in a non-empty list. If we loose interfaces we will end up removing
@@ -282,6 +290,8 @@ void QGenericEngine::doRequestUpdate()
QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)