From b6bf8a4b70091f836a20f4848d3dc00e82bafe3c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 6 Nov 2014 11:36:23 +0200 Subject: Fixed Valgrind reported issues in cpp tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I284832fc697e0ac6ef1ba1bb857892a10cbcd8fd Reviewed-by: Tomi Korpipää --- .../cpptest/q3dscatter-modelproxy/tst_proxy.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'tests/auto/cpptest/q3dscatter-modelproxy') diff --git a/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp b/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp index 9d5cea90..0dccd54f 100644 --- a/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dscatter-modelproxy/tst_proxy.cpp @@ -120,9 +120,9 @@ void tst_proxy::initializeProperties() { QVERIFY(m_proxy); - QTableWidget *table = new QTableWidget(); + QTableWidget table; - m_proxy->setItemModel(table->model()); + m_proxy->setItemModel(table.model()); m_proxy->setRotationRole("rotation"); m_proxy->setRotationRolePattern(QRegExp("/-/")); m_proxy->setRotationRoleReplace("\\\\1"); @@ -153,26 +153,26 @@ void tst_proxy::initializeProperties() void tst_proxy::addModel() { - QTableWidget *table = new QTableWidget(); + QTableWidget table; QStringList rows; rows << "row 1"; QStringList columns; columns << "col 1"; const char *values[1][2] = {{"0/0/5.5/30", "0/0/10.5/30"}}; - table->setRowCount(2); - table->setColumnCount(1); + table.setRowCount(2); + table.setColumnCount(1); for (int col = 0; col < columns.size(); col++) { for (int row = 0; row < rows.size(); row++) { - QModelIndex index = table->model()->index(col, row); - table->model()->setData(index, values[col][row]); + QModelIndex index = table.model()->index(col, row); + table.model()->setData(index, values[col][row]); } } - m_proxy->setItemModel(table->model()); - m_proxy->setXPosRole(table->model()->roleNames().value(Qt::DisplayRole)); - m_proxy->setZPosRole(table->model()->roleNames().value(Qt::DisplayRole)); + m_proxy->setItemModel(table.model()); + m_proxy->setXPosRole(table.model()->roleNames().value(Qt::DisplayRole)); + m_proxy->setZPosRole(table.model()->roleNames().value(Qt::DisplayRole)); m_proxy->setXPosRolePattern(QRegExp(QStringLiteral("^(\\d*)\\/(\\d*)\\/\\d*[\\.\\,]?\\d*\\/\\d*[\\.\\,]?\\d*$"))); m_proxy->setXPosRoleReplace(QStringLiteral("\\2")); m_proxy->setYPosRolePattern(QRegExp(QStringLiteral("^\\d*(\\/)(\\d*)\\/(\\d*[\\.\\,]?\\d*)\\/\\d*[\\.\\,]?\\d*$"))); @@ -187,6 +187,9 @@ void tst_proxy::addModel() QCOMPARE(m_proxy->itemCount(), 2); QVERIFY(m_proxy->series()); + + delete series; + m_proxy = 0; // proxy gets deleted with series } QTEST_MAIN(tst_proxy) -- cgit v1.2.3