diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-02-03 12:16:35 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2011-02-04 11:36:53 (GMT) |
commit | 97512b51ca8addc4fe1f8b5a4f7af14a13d4fd83 (patch) | |
tree | 1f5b335d14f79de1c537b05f0c136db224ccddd3 /src/network | |
parent | d0c0aaf859452349c5cd64cbdba4ebb722c7722f (diff) | |
download | Qt-97512b51ca8addc4fe1f8b5a4f7af14a13d4fd83.zip Qt-97512b51ca8addc4fe1f8b5a4f7af14a13d4fd83.tar.gz Qt-97512b51ca8addc4fe1f8b5a4f7af14a13d4fd83.tar.bz2 |
Fix random crashes when bearer suddenly goes down
1. QNetworkSession being deleted from the closed signal caused data
abort or E32User-CBase 49 panics. (both observed)
2. Potential E32User-CBase 46 panic in
ConnectionProgressNotifier::StartNotifications()
Reviewed-by: Aaron Tunney
Reviewed-By: Markus Goetz
Task-Number: QTBUG-17196
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 7 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.cpp | 3 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.h | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 7d37375..9c5a035 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1358,10 +1358,11 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co networkSession = QSharedNetworkSessionManager::getSession(config); - QObject::connect(networkSession.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected())); - QObject::connect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); + QObject::connect(networkSession.data(), SIGNAL(opened()), q, SIGNAL(networkSessionConnected()), Qt::QueuedConnection); + //QueuedConnection is used to avoid deleting the networkSession inside its closed signal + QObject::connect(networkSession.data(), SIGNAL(closed()), q, SLOT(_q_networkSessionClosed()), Qt::QueuedConnection); QObject::connect(networkSession.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); _q_networkSessionStateChanged(networkSession->state()); } diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 41a8854..474ac6d 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -250,6 +250,9 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig, } } } + + qRegisterMetaType<QNetworkSession::State>(); + qRegisterMetaType<QNetworkSession::SessionError>(); } /*! diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 717e085..da0c486 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -140,6 +140,9 @@ private: QNetworkSessionPrivate *d; }; +Q_DECLARE_METATYPE(QNetworkSession::State); +Q_DECLARE_METATYPE(QNetworkSession::SessionError); + #ifndef QT_MOBILITY_BEARER QT_END_NAMESPACE #else |