tst_QNetworkReply: use QtCore's QScopedPointerDeleteLater

... instead of rolling your own.

Pick-to: 6.7 6.6 6.5
Change-Id: I4fee2218eb874bfee34bd3a0abac3f85b0746540
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Marc Mutz 2024-03-20 10:33:07 +01:00
parent 40714c1ddd
commit 17d2550ed0
1 changed files with 2 additions and 10 deletions

View File

@ -6442,14 +6442,6 @@ struct QThreadCleanup
}
};
struct QDeleteLaterCleanup
{
static inline void cleanup(QObject *o)
{
o->deleteLater();
}
};
#if QT_CONFIG(networkproxy)
void tst_QNetworkReply::httpProxyCommandsSynchronous()
{
@ -6461,7 +6453,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous()
// the server thread, because the client is never returning to the
// event loop
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());
manager.setProxy(proxy);
@ -8677,7 +8669,7 @@ void tst_QNetworkReply::synchronousAuthenticationCache()
// the server thread, because the client is never returning to the
// event loop
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;
//1) URL without credentials, we are not authenticated