Call wait() after calling quit() so that it can gracefully finish
authorAndy Shaw <andy.shaw@digia.com>
Wed, 7 Mar 2012 12:08:02 +0000 (13:08 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 8 Mar 2012 04:31:40 +0000 (05:31 +0100)
There was a problem with slow https connections that if the download
was ongoing when quit() was called then it tended to cause a crash
because it tries to shutdown the SSL connection.

Task-number: QTBUG-24594
Change-Id: I6b161bc7a9bb99e41849537462de2d7c92661902
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
src/network/access/qnetworkaccessmanager.cpp
src/network/access/qnetworkreplyhttpimpl.cpp

index c65edb6..397bb05 100644 (file)
@@ -1185,6 +1185,7 @@ void QNetworkAccessManagerPrivate::clearCache(QNetworkAccessManager *manager)
     if (manager->d_func()->httpThread) {
         // The thread will deleteLater() itself from its finished() signal
         manager->d_func()->httpThread->quit();
+        manager->d_func()->httpThread->wait(5000);
         manager->d_func()->httpThread = 0;
     }
 }
@@ -1194,6 +1195,7 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate()
     if (httpThread) {
         // The thread will deleteLater() itself from its finished() signal
         httpThread->quit();
+        httpThread->wait(5000);
         httpThread = 0;
     }
 }
index 1f45674..a914ee3 100644 (file)
@@ -904,6 +904,7 @@ void QNetworkReplyHttpImplPrivate::postRequest()
 
         // End the thread. It will delete itself from the finished() signal
         thread->quit();
+        thread->wait(5000);
 
         finished();
     } else {