summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-17 01:08:51 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-08-18 23:40:29 +0300
commit5941f192ab84fec21ab762ad3b54378a75f9c99e (patch)
treeb14566592eb8fb346677a605dd09328d6f38e76a
parent0b3390f33d4f995273289ccc49ce235619c2903d (diff)
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 <thiago.macieira@intel.com>
-rw-r--r--tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
index f24c48c0e1..9b2b730950 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<Benchmark *> 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<Benchmark *> benchmarks;
benchmarks << (new DrawText(shortString, DrawText::PainterMode));
benchmarks << (new DrawText(middleString, DrawText::PainterMode));
benchmarks << (new DrawText(longString, DrawText::PainterMode));