diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-08 03:04:13 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-11 22:27:21 (GMT) |
commit | cf69144f2b5511c6e4e81bd9da8ee6acd2340e5c (patch) | |
tree | 5df42e812b7c824486cc8ae7f333e99e5b5bd176 /src/plugins/bearer/icd/qicdengine.cpp | |
parent | 0b2190dad38cbe4c8245d500a0fc7cf6f69cc0da (diff) | |
download | Qt-cf69144f2b5511c6e4e81bd9da8ee6acd2340e5c.zip Qt-cf69144f2b5511c6e4e81bd9da8ee6acd2340e5c.tar.gz Qt-cf69144f2b5511c6e4e81bd9da8ee6acd2340e5c.tar.bz2 |
Make QNetworkConfigurationManager and QNetworkConfiguration threadsafe.
Diffstat (limited to 'src/plugins/bearer/icd/qicdengine.cpp')
-rw-r--r-- | src/plugins/bearer/icd/qicdengine.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 5e506ef..5e9dc0a 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -180,7 +180,10 @@ void QIcdEngine::doRequestUpdate() ptr->roamingSupported = false; userChoiceConfigurations.insert(ptr->id, ptr); + + locker.unlock(); emit configurationAdded(ptr); + locker.relock(); } /* We return currently configured IAPs in the first run and do the WLAN @@ -241,7 +244,10 @@ void QIcdEngine::doRequestUpdate() QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(iap_id, ptr); + + locker.unlock(); emit configurationAdded(ptr); + locker.relock(); #ifdef BEARER_MANAGEMENT_DEBUG qDebug("IAP: %s, name: %s, ssid: %s, added to known list", @@ -299,6 +305,8 @@ void QIcdEngine::doRequestUpdate() bool changed = false; + ptr->mutex.lock(); + if (!ptr->isValid) { ptr->isValid = true; changed = true; @@ -319,8 +327,13 @@ void QIcdEngine::doRequestUpdate() iapid.toAscii().data(), scanned_ssid.data()); #endif - if (changed) + ptr->mutex.unlock(); + + if (changed) { + locker.unlock(); emit configurationChanged(ptr); + locker.relock(); + } if (!ap.scan.network_type.startsWith("WLAN")) continue; // not a wlan AP @@ -354,7 +367,10 @@ void QIcdEngine::doRequestUpdate() QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); + + locker.unlock(); emit configurationAdded(ptr); + locker.relock(); } } } @@ -363,11 +379,15 @@ void QIcdEngine::doRequestUpdate() QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); + locker.unlock(); emit configurationRemoved(ptr); + locker.relock(); } - if (sender()) + if (sender()) { + locker.unlock(); emit updateCompleted(); + } } void QIcdEngine::deleteConfiguration(const QString &iap_id) @@ -384,6 +404,7 @@ void QIcdEngine::deleteConfiguration(const QString &iap_id) qDebug() << "IAP" << iap_id << "was removed from storage."; #endif + locker.unlock(); emit configurationRemoved(ptr); } else { #ifdef BEARER_MANAGEMENT_DEBUG |