summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-12-09 07:52:15 +0100
committerDavid Schulz <david.schulz@theqtcompany.com>2015-12-09 08:22:31 +0000
commit1a8f37db0e61155aa23746f8839c8970772d3f22 (patch)
treec0509b2dd575fa357bcf25436513e037e4d051ee
parent7eab6a53b17747bf706d9f42bbb13d65f9a97ef6 (diff)
downloadqt-creator-1a8f37db0e61155aa23746f8839c8970772d3f22.tar.gz
Delete pointer if it is no more used...at-v3.6.0at-3.6
...and postpone creation of the newItem object a bit. Change-Id: Id2322dcaae33cd902267dc73d2929db06880e20c Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
-rw-r--r--plugins/autotest/testresultmodel.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/autotest/testresultmodel.cpp b/plugins/autotest/testresultmodel.cpp
index 5a09b5670b..3e945a656c 100644
--- a/plugins/autotest/testresultmodel.cpp
+++ b/plugins/autotest/testresultmodel.cpp
@@ -137,7 +137,6 @@ void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand)
QVector<Utils::TreeItem *> topLevelItems = rootItem()->children();
int lastRow = topLevelItems.size() - 1;
- TestResultItem *newItem = new TestResultItem(testResult);
// we'll add the new item, so raising it's counter
if (!isCurrentTestMssg) {
int count = m_testResultCount.value(testResult->result(), 0);
@@ -150,14 +149,16 @@ void TestResultModel::addTestResult(TestResult *testResult, bool autoExpand)
if (result && result->result() == Result::MESSAGE_CURRENT_TEST) {
current->updateDescription(testResult->description());
emit dataChanged(current->index(), current->index());
+ delete testResult;
return;
}
}
- rootItem()->appendChild(newItem);
+ rootItem()->appendChild(new TestResultItem(testResult));
return;
}
+ TestResultItem *newItem = new TestResultItem(testResult);
// FIXME this might be totally wrong... we need some more unique information!
for (int row = lastRow; row >= 0; --row) {
TestResultItem *current = static_cast<TestResultItem *>(topLevelItems.at(row));