From 5941f192ab84fec21ab762ad3b54378a75f9c99e Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 17 Aug 2023 01:08:51 +0300 Subject: [PATCH] tst_QtBench: fix leak Instead make "benchmarks" a member variable and call qDeleteAll() on it in cleanupTestCase(). This doesn't make much difference since the allocated resources would be freed when the whole test is destroyed anyway, but still. Change-Id: Iba66d32697fd3f2283185ee65a0a514176b4b258 Reviewed-by: Thiago Macieira --- tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp index f24c48c0e1c..9b2b730950d 100644 --- a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp +++ b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp @@ -107,9 +107,13 @@ class tst_QtBench : public QObject { Q_OBJECT + QList benchmarks; + private slots: void qtBench(); void qtBench_data(); + + void cleanupTestCase() { qDeleteAll(benchmarks); } }; QString makeString(int length) @@ -159,7 +163,6 @@ void tst_QtBench::qtBench_data() "i erat, sed pellentesque\n" "mi. Curabitur sed."; - QList benchmarks; benchmarks << (new DrawText(shortString, DrawText::PainterMode)); benchmarks << (new DrawText(middleString, DrawText::PainterMode)); benchmarks << (new DrawText(longString, DrawText::PainterMode));