diff options
author | Jonathan White <support@dmapps.us> | 2017-12-13 07:38:23 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2017-12-13 07:46:25 +0300 |
commit | 0141fa2f1c5432428f80f8ad0e5b338f23f98747 (patch) | |
tree | 0932ae251a528563429e564a44001de928ff1dc1 /tests | |
parent | 24b1ec25920e89ae21bf6805863e79cef723c612 (diff) |
Correct memory leaks in TestGroup.cpp
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TestGroup.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp index 5f654ee3a..24bdfeb5a 100644 --- a/tests/TestGroup.cpp +++ b/tests/TestGroup.cpp @@ -385,18 +385,19 @@ void TestGroup::testClone() QCOMPARE(clonedGroupKeepUuid->entries().at(0)->uuid(), originalGroupEntry->uuid()); QCOMPARE(clonedGroupKeepUuid->children().at(0)->entries().at(0)->uuid(), subGroupEntry->uuid()); - Group* clonedGroupNoFlags = originalGroup->clone(Entry::CloneNoFlags, Group::CloneNoFlags); + QScopedPointer<Group> clonedGroupNoFlags(originalGroup->clone(Entry::CloneNoFlags, Group::CloneNoFlags)); QCOMPARE(clonedGroupNoFlags->entries().size(), 0); QVERIFY(clonedGroupNoFlags->uuid() == originalGroup->uuid()); - Group* clonedGroupNewUuid = originalGroup->clone(Entry::CloneNoFlags, Group::CloneNewUuid); + QScopedPointer<Group> clonedGroupNewUuid(originalGroup->clone(Entry::CloneNoFlags, Group::CloneNewUuid)); QCOMPARE(clonedGroupNewUuid->entries().size(), 0); QVERIFY(clonedGroupNewUuid->uuid() != originalGroup->uuid()); // Making sure the new modification date is not the same. QTest::qSleep(1); - Group* clonedGroupResetTimeInfo = originalGroup->clone(Entry::CloneNoFlags, Group::CloneNewUuid | Group::CloneResetTimeInfo); + QScopedPointer<Group> clonedGroupResetTimeInfo(originalGroup->clone(Entry::CloneNoFlags, + Group::CloneNewUuid | Group::CloneResetTimeInfo)); QCOMPARE(clonedGroupResetTimeInfo->entries().size(), 0); QVERIFY(clonedGroupResetTimeInfo->uuid() != originalGroup->uuid()); QVERIFY(clonedGroupResetTimeInfo->timeInfo().lastModificationTime() != originalGroup->timeInfo().lastModificationTime()); |