Commit e1dfaf37a1411d1afaaa63684b54a443d19df7e2
fix crash on 10.6 with no wifi interface
Task-number: QTBUG-8954
| |   |
| 97 | 97 | CFRunLoopSourceRef runloopSource; |
| 98 | 98 | |
| 99 | 99 | void startNetworkChangeLoop(); |
| bool hasWifi; |
| 100 | 101 | |
| 101 | 102 | }; |
| 102 | 103 | |
| |   |
| 158 | 158 | startNetworkChangeLoop(); |
| 159 | 159 | |
| 160 | 160 | #if defined(MAC_SDK_10_6) |
| if(!listener) { |
| if([[CWInterface supportedInterfaces] count] > 0 && !listener) { |
| 162 | 162 | listener = [[QNSListener alloc] init]; |
| 163 | 163 | listener.engine = this; |
| hasWifi = true; |
| } else { |
| hasWifi = false; |
| 164 | 167 | } |
| 165 | 168 | #endif |
| 166 | 169 | } |
| … | … | |
| 404 | 404 | QStringList found; |
| 405 | 405 | |
| 406 | 406 | #if defined(MAC_SDK_10_6) |
| QMacCocoaAutoReleasePool pool; |
| if(!hasWifi) { |
| return found; |
| } |
| 408 | 410 | |
| QMacCocoaAutoReleasePool pool; |
|
| 409 | 413 | CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)]; |
| 410 | 414 | if([currentInterface power]) { |
| 411 | 415 | NSError *err = nil; |
| … | … | |
| 504 | 504 | QMutexLocker locker(&mutex); |
| 505 | 505 | |
| 506 | 506 | #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; |
| } |
| 510 | 512 | #else |
| 511 | 513 | Q_UNUSED(wifiDeviceName); |
| 512 | 514 | #endif |
| … | … | |
| 520 | 520 | QMutexLocker locker(&mutex); |
| 521 | 521 | |
| 522 | 522 | #if defined(MAC_SDK_10_6) |
| if(!hasWifi) { return false; } |
| 523 | 524 | CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceName)]; |
| 524 | 525 | CWConfiguration *userConfig = [wifiInterface configuration]; |
| 525 | 526 | NSSet *remNets = [userConfig rememberedNetworks]; |