summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-10 03:22:32 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-06-24 02:27:35 (GMT)
commit793fbbbf5ae3860b5091c760b3cd0d467369cc1a (patch)
tree99d0cca92239cbaad8b0ce9e73b7c42b458dc53c /src
parentfdc0d441e1c1331fb639e5d5f59daf3fb22a7e24 (diff)
downloadQt-793fbbbf5ae3860b5091c760b3cd0d467369cc1a.zip
Qt-793fbbbf5ae3860b5091c760b3cd0d467369cc1a.tar.gz
Qt-793fbbbf5ae3860b5091c760b3cd0d467369cc1a.tar.bz2
Cherry pick fix for QTMOBILITY-240 from Qt Mobility.
c84a6d828bcb7f66d1ac06e1a7a84c5a8ba9cec4
Diffstat (limited to 'src')
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp60
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp90
2 files changed, 88 insertions, 62 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index e08d135..20e13d2 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -694,8 +694,17 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
SymbianNetworkConfigurationPrivate *symbianConfig =
toSymbianConfig(privateConfiguration(configs[i]));
- if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint())
- emit preferredConfigurationChanged(configs[i], aIsSeamless);
+ if (symbianConfig->numericIdentifier() == aNewAPInfo.AccessPoint()) {
+ // Any slot connected to the signal might throw an std::exception,
+ // which must not propagate into Symbian code (this function is a callback
+ // from platform). We could convert exception to a symbian Leave, but since the
+ // prototype of this function bans this (no trailing 'L'), we just catch
+ // and drop.
+ QT_TRY {
+ emit preferredConfigurationChanged(configs[i], aIsSeamless);
+ }
+ QT_CATCH (std::exception&) {}
+ }
}
} else {
migrate();
@@ -705,7 +714,10 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/)
{
if (iALREnabled > 0) {
- emit newConfigurationActivated();
+ QT_TRY {
+ emit newConfigurationActivated();
+ }
+ QT_CATCH (std::exception&) {}
} else {
accept();
}
@@ -727,18 +739,24 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/)
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
- // In some cases IAP is still in Connected state when
- // syncStateWithInterface(); is called
- // => Following call makes sure that Session state
- // changes immediately to Disconnected.
- newState(QNetworkSession::Disconnected);
- emit closed();
+ QT_TRY {
+ syncStateWithInterface();
+ // In some cases IAP is still in Connected state when
+ // syncStateWithInterface(); is called
+ // => Following call makes sure that Session state
+ // changes immediately to Disconnected.
+ newState(QNetworkSession::Disconnected);
+ emit closed();
+ }
+ QT_CATCH (std::exception&) {}
} else if (iStoppedByUser) {
// If the user of this session has called the stop() and
// configuration is based on internet SNAP, this needs to be
// done here because platform might roam.
- newState(QNetworkSession::Disconnected);
+ QT_TRY {
+ newState(QNetworkSession::Disconnected);
+ }
+ QT_CATCH (std::exception&) {}
}
}
#endif
@@ -978,12 +996,12 @@ void QNetworkSessionPrivateImpl::RunL()
if (error != KErrNone) {
isOpen = false;
iError = QNetworkSession::UnknownSessionError;
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
return;
}
@@ -1010,8 +1028,10 @@ void QNetworkSessionPrivateImpl::RunL()
startTime = QDateTime::currentDateTime();
- newState(QNetworkSession::Connected);
- emit quitPendingWaitsForOpened();
+ QT_TRYCATCH_LEAVING({
+ newState(QNetworkSession::Connected);
+ emit quitPendingWaitsForOpened();
+ });
}
break;
case KErrNotFound: // Connection failed
@@ -1019,12 +1039,12 @@ void QNetworkSessionPrivateImpl::RunL()
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::InvalidConfigurationError;
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
case KErrCancel: // Connection attempt cancelled
case KErrAlreadyExists: // Connection already exists
@@ -1038,12 +1058,12 @@ void QNetworkSessionPrivateImpl::RunL()
} else {
iError = QNetworkSession::UnknownSessionError;
}
- emit QNetworkSessionPrivate::error(iError);
+ QT_TRYCATCH_LEAVING(emit QNetworkSessionPrivate::error(iError));
Cancel();
if (ipConnectionNotifier) {
ipConnectionNotifier->StopNotifications();
}
- syncStateWithInterface();
+ QT_TRYCATCH_LEAVING(syncStateWithInterface());
break;
}
}
@@ -1364,7 +1384,7 @@ void ConnectionProgressNotifier::DoCancel()
void ConnectionProgressNotifier::RunL()
{
if (iStatus == KErrNone) {
- iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError);
+ QT_TRYCATCH_LEAVING(iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError));
SetActive();
iConnection.ProgressNotification(iProgress, iStatus);
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index ab1ba28..3d462ee 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -272,7 +272,11 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ptr->id, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ // Emit configuration added. Connected slots may throw execptions
+ // which propagate here --> must be converted to leaves (standard
+ // std::exception would cause any TRAP trapping this function to terminate
+ // program).
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
}
}
@@ -293,10 +297,9 @@ void SymbianEngine::updateConfigurationsL()
knownSnapConfigs.removeOne(ident);
} else {
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
- CleanupStack::PushL(cpPriv);
HBufC *pName = destination.NameLC();
- cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
@@ -313,10 +316,8 @@ void SymbianEngine::updateConfigurationsL()
snapConfigurations.insert(ident, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
-
- CleanupStack::Pop(cpPriv);
}
QNetworkConfigurationPrivatePointer privSNAP = snapConfigurations.value(ident);
@@ -336,7 +337,7 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ptr->id, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
QMutexLocker configLocker(&privSNAP->mutex);
@@ -390,7 +391,7 @@ void SymbianEngine::updateConfigurationsL()
accessPointConfigurations.insert(ident, ptr);
mutex.unlock();
- emit configurationAdded(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationAdded(ptr));
mutex.lock();
} else {
delete cpPriv;
@@ -400,7 +401,7 @@ void SymbianEngine::updateConfigurationsL()
}
CleanupStack::PopAndDestroy(pDbTView);
#endif
- updateActiveAccessPoints();
+ QT_TRYCATCH_LEAVING(updateActiveAccessPoints());
foreach (const QString &oldIface, knownConfigs) {
//remove non existing IAP
@@ -408,6 +409,7 @@ void SymbianEngine::updateConfigurationsL()
mutex.unlock();
emit configurationRemoved(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr));
mutex.lock();
// Remove non existing IAP from SNAPs
@@ -431,6 +433,7 @@ void SymbianEngine::updateConfigurationsL()
mutex.unlock();
emit configurationRemoved(ptr);
+ QT_TRYCATCH_LEAVING(emit configurationRemoved(ptr));
mutex.lock();
}
@@ -445,14 +448,12 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
RCmConnectionMethod& connectionMethod)
{
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
- CleanupStack::PushL(cpPriv);
-
TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId);
QString ident = QString::number(qHash(iapId));
HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName);
CleanupStack::PushL(pName);
- cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
@@ -500,7 +501,7 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
if (error == KErrNone && pName) {
CleanupStack::PushL(pName);
- cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length());
+ QT_TRYCATCH_LEAVING(cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()));
CleanupStack::PopAndDestroy(pName);
pName = NULL;
}
@@ -518,8 +519,6 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
cpPriv->purpose = QNetworkConfiguration::UnknownPurpose;
cpPriv->roamingSupported = false;
-
- CleanupStack::Pop(cpPriv);
return cpPriv;
}
#else
@@ -552,7 +551,7 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
QString ident = QString::number(qHash(aApId));
- apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length());
+ QT_TRYCATCH_LEAVING(apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()));
apNetworkConfiguration->isValid = true;
apNetworkConfiguration->id = ident;
apNetworkConfiguration->numericId = aApId;
@@ -902,7 +901,7 @@ void SymbianEngine::RunL()
if (event == RDbNotifier::ECommit) {
TRAPD(error, updateConfigurationsL());
if (error == KErrNone) {
- updateStatesToSnaps();
+ QT_TRYCATCH_LEAVING(updateStatesToSnaps());
}
locker.unlock();
waitRandomTime();
@@ -913,7 +912,7 @@ void SymbianEngine::RunL()
locker.relock();
TRAPD(error, updateConfigurationsL());
if (error == KErrNone) {
- updateStatesToSnaps();
+ QT_TRYCATCH_LEAVING(updateStatesToSnaps());
}
}
iIgnoringUpdates = false; // Wait time done, allow updating again
@@ -966,8 +965,10 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
ptr->mutex.lock();
toSymbianConfig(ptr)->connectionId = connectionId;
ptr->mutex.unlock();
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Connecting);
+ QT_TRYCATCH_LEAVING(
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Connecting)
+ );
}
} else if (connectionStatus == KLinkLayerOpen) {
// Connection has been successfully opened
@@ -985,23 +986,27 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
ptr->mutex.unlock();
// Configuration is Active
- if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
- updateStatesToSnaps();
- }
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Connected);
+ QT_TRYCATCH_LEAVING(
+ if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) {
+ updateStatesToSnaps();
+ }
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Connected);
- if (!iOnline) {
- iOnline = true;
- emit this->onlineStateChanged(iOnline);
- }
+ if (!iOnline) {
+ iOnline = true;
+ emit this->onlineStateChanged(iOnline);
+ }
+ );
}
} else if (connectionStatus == KConfigDaemonStartingDeregistration) {
TUint connectionId = realEvent->ConnectionId();
QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
if (ptr) {
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Closing);
+ QT_TRYCATCH_LEAVING(
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Closing)
+ );
}
} else if (connectionStatus == KLinkLayerClosed ||
connectionStatus == KConnectionClosed) {
@@ -1011,12 +1016,13 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId);
if (ptr) {
// Configuration is either Defined or Discovered
- if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
- updateStatesToSnaps();
- }
-
- emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
- connectionId, QNetworkSession::Disconnected);
+ QT_TRYCATCH_LEAVING(
+ if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) {
+ updateStatesToSnaps();
+ }
+ emit configurationStateChanged(toSymbianConfig(ptr)->numericIdentifier(),
+ connectionId, QNetworkSession::Disconnected);
+ );
}
bool online = false;
@@ -1030,7 +1036,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
if (iOnline != online) {
iOnline = online;
- emit this->onlineStateChanged(iOnline);
+ QT_TRYCATCH_LEAVING(emit this->onlineStateChanged(iOnline));
}
}
}
@@ -1048,7 +1054,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
if (ptr) {
// Configuration is either Discovered or Active
- changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered);
+ QT_TRYCATCH_LEAVING(changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered));
unDiscoveredConfigs.removeOne(ident);
}
}
@@ -1056,7 +1062,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface);
if (ptr) {
// Configuration is Defined
- changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined);
+ QT_TRYCATCH_LEAVING(changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined));
}
}
}
@@ -1198,9 +1204,9 @@ void AccessPointsAvailabilityScanner::RunL()
if (iStatus.Int() != KErrNone) {
iIapBuf().iCount = 0;
- iOwner.accessPointScanningReady(false,iIapBuf());
+ QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(false,iIapBuf()));
} else {
- iOwner.accessPointScanningReady(true,iIapBuf());
+ QT_TRYCATCH_LEAVING(iOwner.accessPointScanningReady(true,iIapBuf()));
}
}