From d0096381d2229db897dbd44f7ee476d4ed03a5f7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Dec 2011 15:46:17 +0100 Subject: [PATCH] qdeclarativexmlhttprequest: Stabilize, ensure deletion of server. Introduce QScopedPointer to make sure the server is also deleted in case the test fails thus suppressing follow-up errors caused by the port still being in use by a leaked server. Change-Id: I9fd8a96ea5aba42487df8f22bc9a79917b9d8c16 Reviewed-by: Friedemann Kleint --- .../tst_qdeclarativexmlhttprequest.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index da5431c..abefa30 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "testhttpserver.h" #include "../../shared/util.h" @@ -254,9 +255,9 @@ void tst_qdeclarativexmlhttprequest::open() QFETCH(QString, url); QFETCH(bool, remote); - TestHTTPServer *server = 0; + QScopedPointer server; // ensure deletion in case test fails if (remote) { - server = new TestHTTPServer(SERVER_PORT); + server.reset(new TestHTTPServer(SERVER_PORT)); QVERIFY(server->isValid()); QVERIFY(server->wait(TEST_FILE("open_network.expect"), TEST_FILE("open_network.reply"), @@ -278,7 +279,6 @@ void tst_qdeclarativexmlhttprequest::open() QTRY_VERIFY(object->property("dataOK").toBool() == true); - delete server; delete object; } -- 1.7.2.5