summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-03-12 02:19:23 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-03-12 02:19:23 (GMT)
commite1dfaf37a1411d1afaaa63684b54a443d19df7e2 (patch)
treefdb9cdc0c3fb8f9e864fd9d39c1d69a0ed946e99 /src/plugins
parent45540361bb238ee2d83aad7fd95ac6700692a709 (diff)
downloadQt-e1dfaf37a1411d1afaaa63684b54a443d19df7e2.zip
Qt-e1dfaf37a1411d1afaaa63684b54a443d19df7e2.tar.gz
Qt-e1dfaf37a1411d1afaaa63684b54a443d19df7e2.tar.bz2
fix crash on 10.6 with no wifi interface
Task-number: QTBUG-8954
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h1
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm20
2 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 4fb9fdb..f6d5b7a 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -97,6 +97,7 @@ private:
CFRunLoopSourceRef runloopSource;
void startNetworkChangeLoop();
+ bool hasWifi;
};
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 26ea84f..84dd6a5 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -158,9 +158,12 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
startNetworkChangeLoop();
#if defined(MAC_SDK_10_6)
- if(!listener) {
+ if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
listener = [[QNSListener alloc] init];
listener.engine = this;
+ hasWifi = true;
+ } else {
+ hasWifi = false;
}
#endif
}
@@ -401,7 +404,11 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
QStringList found;
#if defined(MAC_SDK_10_6)
- QMacCocoaAutoReleasePool pool;
+ if(!hasWifi) {
+ return found;
+ }
+
+ QMacCocoaAutoReleasePool pool;
CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
if([currentInterface power]) {
@@ -497,9 +504,11 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
QMutexLocker locker(&mutex);
#if defined(MAC_SDK_10_6)
- CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)];
- if([defaultInterface power])
- return true;
+ if(hasWifi) {
+ CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)];
+ if([defaultInterface power])
+ return true;
+ }
#else
Q_UNUSED(wifiDeviceName);
#endif
@@ -511,6 +520,7 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s
QMutexLocker locker(&mutex);
#if defined(MAC_SDK_10_6)
+ if(!hasWifi) { return false; }
CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceName)];
CWConfiguration *userConfig = [wifiInterface configuration];
NSSet *remNets = [userConfig rememberedNetworks];