summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyimpl.cpp
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-05-31 15:09:38 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-06-06 13:31:30 (GMT)
commit4d5296d18f3e201daf054d715401a011325e909c (patch)
tree220ad2e9ecb30cf48399667cc44f8605f0f54c9c /src/network/access/qnetworkreplyimpl.cpp
parentbd501eeebfad5ed8fe6d29a9c2c0a26f844bef58 (diff)
downloadQt-4d5296d18f3e201daf054d715401a011325e909c.zip
Qt-4d5296d18f3e201daf054d715401a011325e909c.tar.gz
Qt-4d5296d18f3e201daf054d715401a011325e909c.tar.bz2
QNAM - maintain a weak reference to the QNetworkSession
When handling signals from the session, a pointer is needed. Also the QNetworkReplyImpl needs to access the manager's session. So, the manager should have a strong and weak reference. The strong reference is held during connection establishment. The weak reference is held all the time, though it will become null when the session is destroyed in idle. The non static member function getNetworkSession() is used to create strong references from the weak reference where required. Task-number: ou1cimx#1004278 Change-Id: I4b5b36b1d996b98e659d993969006c61b4440c15 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com> (backported from commit bae1613c4c3d8c38b90ed2ba5c1b149e1bc87987)
Diffstat (limited to 'src/network/access/qnetworkreplyimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index b0e81e9..6f885d1 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -97,12 +97,12 @@ void QNetworkReplyImplPrivate::_q_startOperation()
// state changes.
state = WaitingForSession;
- QNetworkSession *session = manager->d_func()->networkSession.data();
+ QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());
if (session) {
Q_Q(QNetworkReplyImpl);
- QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)),
+ QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)),
q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection);
if (!session->isOpen())
@@ -268,7 +268,7 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected()
if (manager.isNull())
return;
- QNetworkSession *session = manager->d_func()->networkSession.data();
+ QSharedPointer<QNetworkSession> session = manager->d_func()->getNetworkSession();
if (!session)
return;
@@ -746,7 +746,7 @@ void QNetworkReplyImplPrivate::finished()
if (!manager.isNull()) {
#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkSession *session = manager->d_func()->networkSession.data();
+ QSharedPointer<QNetworkSession> session (manager->d_func()->getNetworkSession());
if (session && session->state() == QNetworkSession::Roaming &&
state == Working && errorCode != QNetworkReply::OperationCanceledError) {
// only content with a known size will fail with a temporary network failure error