tst_QNetworkReply: use QtCore's QScopedPointerDeleteLater
... instead of rolling your own. Pick-to: 6.5 Change-Id: I4fee2218eb874bfee34bd3a0abac3f85b0746540 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 17d2550ed09c564977d4e9414f60c5514ce4f76a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 2f7cdec2c98be9f7fce3849b951a1869e3072a46)
This commit is contained in:
parent
27998d611d
commit
ecfec47c50
@ -6056,14 +6056,6 @@ struct QThreadCleanup
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QDeleteLaterCleanup
|
|
||||||
{
|
|
||||||
static inline void cleanup(QObject *o)
|
|
||||||
{
|
|
||||||
o->deleteLater();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#if QT_CONFIG(networkproxy)
|
#if QT_CONFIG(networkproxy)
|
||||||
void tst_QNetworkReply::httpProxyCommandsSynchronous()
|
void tst_QNetworkReply::httpProxyCommandsSynchronous()
|
||||||
{
|
{
|
||||||
@ -6075,7 +6067,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous()
|
|||||||
// the server thread, because the client is never returning to the
|
// the server thread, because the client is never returning to the
|
||||||
// event loop
|
// event loop
|
||||||
QScopedPointer<QThread, QThreadCleanup> serverThread(new QThread);
|
QScopedPointer<QThread, QThreadCleanup> serverThread(new QThread);
|
||||||
QScopedPointer<MiniHttpServer, QDeleteLaterCleanup> proxyServer(new MiniHttpServer(responseToSend, false, serverThread.data()));
|
QScopedPointer<MiniHttpServer, QScopedPointerDeleteLater> proxyServer(new MiniHttpServer(responseToSend, false, serverThread.data()));
|
||||||
QNetworkProxy proxy(QNetworkProxy::HttpProxy, "127.0.0.1", proxyServer->serverPort());
|
QNetworkProxy proxy(QNetworkProxy::HttpProxy, "127.0.0.1", proxyServer->serverPort());
|
||||||
|
|
||||||
manager.setProxy(proxy);
|
manager.setProxy(proxy);
|
||||||
@ -8278,7 +8270,7 @@ void tst_QNetworkReply::synchronousAuthenticationCache()
|
|||||||
// the server thread, because the client is never returning to the
|
// the server thread, because the client is never returning to the
|
||||||
// event loop
|
// event loop
|
||||||
QScopedPointer<QThread, QThreadCleanup> serverThread(new QThread);
|
QScopedPointer<QThread, QThreadCleanup> serverThread(new QThread);
|
||||||
QScopedPointer<MiniHttpServer, QDeleteLaterCleanup> server(new MiniAuthServer(serverThread.data()));
|
QScopedPointer<MiniHttpServer, QScopedPointerDeleteLater> server(new MiniAuthServer(serverThread.data()));
|
||||||
server->doClose = true;
|
server->doClose = true;
|
||||||
|
|
||||||
//1) URL without credentials, we are not authenticated
|
//1) URL without credentials, we are not authenticated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user