Qt 4.6.4: QNetworkAccessManager cannot close the connection
I'm developing an application in qt4.6.4 for symbian 5.2 which uses QNetworkAccessManager for HTTP communication.
I'm facing a problem that connection is left open after usage, even QNetworkAccessManager and QNetworkReply class instances are deleted. I spent quite a lot time by trying different ways of delete instances, but nothing helps.
However, connection is closed when application is exited.
Has anyone faced same problem?
Is there any way to close network connection by using those classes?
I know connection can be closed by using QNetworkSession but in our environment
it is still part of qt mobility api and we cannot take it into the use.
if (m_manager == NULL)
m_manager = new QNetworkAccessManager(this);
} m_reply = m_manager->get(QNetworkRequest(QUrl("http://qt.nokia.com"))); connect(m_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleFinished(QNetworkReply*)));
void webclient::handleFinished(QNetworkReply *reply)
//m_reply->deleteLater(); //this is also tried, and many other ways too..
delete m_reply; m_reply = NULL; delete m_manager; m_manager = NULL;
[edit: code highlighted / Denis Kormalev]
As far as I know, it is not possible to close the connection without QNetworkSession. QNetworkAccessManager does not give you this option in Qt 4.6. In Qt 4.7 it is possible, I think.
hi, did you confirm that the handleFinished() slot was called ... there if you call the close() on m_reply, that should free the resources