summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/corewlan
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/corewlan
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/corewlan')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index fff65e4..a5384d1 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -121,16 +121,22 @@ QCoreWlanEngine::~QCoreWlanEngine()
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.value(id);
}
bool QCoreWlanEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.contains(id);
}
void QCoreWlanEngine::connectToId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
QString interfaceString = getInterfaceFromId(id);
@@ -205,6 +211,8 @@ void QCoreWlanEngine::connectToId(const QString &id)
void QCoreWlanEngine::disconnectFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QString interfaceString = getInterfaceFromId(id);
if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now
#if defined(MAC_SDK_10_6)
@@ -225,12 +233,16 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
void QCoreWlanEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
pollTimer.stop();
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
}
void QCoreWlanEngine::doRequestUpdate()
{
+ QMutexLocker locker(&mutex);
+
getAllScInterfaces();
QStringList previous = accessPointConfigurations.keys();
@@ -330,6 +342,8 @@ void QCoreWlanEngine::doRequestUpdate()
QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
{
+ QMutexLocker locker(&mutex);
+
QStringList found;
#if defined(MAC_SDK_10_6)
@@ -422,6 +436,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
{
+ QMutexLocker locker(&mutex);
+
#if defined(MAC_SDK_10_6)
CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)];
if([defaultInterface power])
@@ -434,6 +450,8 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &ssid)
{
+ QMutexLocker locker(&mutex);
+
#if defined(MAC_SDK_10_6)
CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceName)];
CWConfiguration *userConfig = [wifiInterface configuration];
@@ -451,6 +469,8 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s
bool QCoreWlanEngine::getAllScInterfaces()
{
+ QMutexLocker locker(&mutex);
+
networkInterfaces.clear();
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
@@ -491,6 +511,8 @@ bool QCoreWlanEngine::getAllScInterfaces()
QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)