summaryrefslogtreecommitdiffstats
path: root/tests/manual/bearerex
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-05-13 10:54:01 +1000
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-05-14 13:05:02 +1000
commit608d39c9ffee622114d9bc178d5e8ad3d1eadfb5 (patch)
treea952fe56ccd5de344183af455cb4eb9d045276fa /tests/manual/bearerex
parente75161c4d54406d137f34b9f54fed853c16a6269 (diff)
Cherry pick fix for MOBILITY-962 from Qt Mobility.
6ea1caf2babc68d366fb6d3dc215c1bb18a76368
Diffstat (limited to 'tests/manual/bearerex')
-rw-r--r--tests/manual/bearerex/bearerex.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp
index 19246a2931..bf60dd1c8b 100644
--- a/tests/manual/bearerex/bearerex.cpp
+++ b/tests/manual/bearerex/bearerex.cpp
@@ -300,8 +300,12 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
SessionTab::~SessionTab()
{
+ // Need to be nulled, because modal dialogs may return after destruction of this object and
+ // use already released resources.
delete m_NetworkSession;
+ m_NetworkSession = NULL;
delete m_http;
+ m_http = NULL;
}
void SessionTab::on_createQHttpButton_clicked()
@@ -551,10 +555,16 @@ void SessionTab::done(bool error)
msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes."));
}
msgBox.exec();
-
- sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
- QString(" / ")+
- QString::number(m_NetworkSession->bytesReceived()));
+ // Check if the networksession still exists - it may have gone after returning from
+ // the modal dialog (in the case that app has been closed, and deleting QHttp will
+ // trigger the done() invokation).
+ if (m_NetworkSession) {
+ sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
+ QString(" / ")+
+ QString::number(m_NetworkSession->bytesReceived()));
+ } else {
+ sentRecDataLineEdit->setText("Data amounts not available.");
+ }
}
// End of file