diff options
author | Martin Petersson <Martin.Petersson@nokia.com> | 2012-06-13 08:59:35 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-20 15:45:07 +0200 |
commit | 534bcc96676ac02fc327f9e43d3785c7424b0750 (patch) | |
tree | 4d2796c8c90db9258b450cfca36cabe670c17318 /src/network/access/qnetworkreplyhttpimpl.cpp | |
parent | cf7c93b9283d6dded4fd0e57ed771d8470206093 (diff) |
QNetworkAccessManager: delete the httpThread
The httpThread was using deleteLater the finished signal of the
thread to call the deleteLater slot. If the QNetworkAccessManager is
deleted when the application is closed then then fished is emitted
but we never return to the eventloop so the deletion is never done.
This will delete the httpThread directly instead of using deleteLater
Task-number: QTBUG-25487
Change-Id: I1fdbd4eca01e8bd8b3a98936298e5c78217752b4
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index e1ec9a9a95..3e92126fde 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -620,7 +620,6 @@ void QNetworkReplyHttpImplPrivate::postRequest() // At some point we could switch to having multiple threads if it makes sense. managerPrivate->httpThread = new QThread(); managerPrivate->httpThread->setObjectName(QStringLiteral("httpThread")); - QObject::connect(managerPrivate->httpThread, SIGNAL(finished()), managerPrivate->httpThread, SLOT(deleteLater())); managerPrivate->httpThread->start(); thread = managerPrivate->httpThread; @@ -917,9 +916,12 @@ void QNetworkReplyHttpImplPrivate::postRequest() replyDownloadData(delegate->synchronousDownloadData); } - // End the thread. It will delete itself from the finished() signal thread->quit(); thread->wait(5000); + if (thread->isFinished()) + delete thread; + else + QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); finished(); } else { |