summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-10-16 11:54:07 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-10-19 13:18:12 +0200
commit665966d243c37d384d9529f47cd4456b621e05dd (patch)
tree1693ea6b3c9900f29f6e7e4020a49e7e90964e3f /tests/auto
parent0ebd05686d97c9282f148a18cab32fb079abdbc7 (diff)
tst_QState: fix memleaks
Benign, but easy to avoid by allocating objects on the stack. Change-Id: I1933d0abb2ebd53bcf0402f392e7e3c201756b9e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/statemachine/qstate/tst_qstate.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp b/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
index 182fa8b461..820039b6a9 100644
--- a/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
+++ b/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
@@ -76,35 +76,35 @@ void tst_QState::assignProperty()
{
QStateMachine machine;
- QObject *object = new QObject();
- object->setProperty("fooBar", 10);
+ QObject object;
+ object.setProperty("fooBar", 10);
QState *s1 = new QState(&machine);
- s1->assignProperty(object, "fooBar", 20);
+ s1->assignProperty(&object, "fooBar", 20);
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
- QCOMPARE(object->property("fooBar").toInt(), 20);
+ QCOMPARE(object.property("fooBar").toInt(), 20);
}
void tst_QState::assignPropertyTwice()
{
QStateMachine machine;
- QObject *object = new QObject();
- object->setProperty("fooBar", 10);
+ QObject object;
+ object.setProperty("fooBar", 10);
QState *s1 = new QState(&machine);
- s1->assignProperty(object, "fooBar", 20);
- s1->assignProperty(object, "fooBar", 30);
+ s1->assignProperty(&object, "fooBar", 20);
+ s1->assignProperty(&object, "fooBar", 30);
machine.setInitialState(s1);
machine.start();
QCoreApplication::processEvents();
- QCOMPARE(object->property("fooBar").toInt(), 30);
+ QCOMPARE(object.property("fooBar").toInt(), 30);
}
class EventTestTransition: public QAbstractTransition