Call wait() after calling quit() so that it can gracefully finish

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>
This commit is contained in:
Andy Shaw 2012-03-07 13:08:02 +01:00 committed by Qt by Nokia
parent 4bdc7e6f8b
commit 46c5850263
2 changed files with 3 additions and 0 deletions

View 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;
}
}

View 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 {