summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2023-10-04 17:10:26 +0200
committerIvan Solovev <ivan.solovev@qt.io>2023-10-05 10:27:45 +0200
commit4dfb02932c5569f7430017ba0b77c527e51c9456 (patch)
tree5cf33267d058fd5d4ecb0151aa0d40b32d8bf00e /tests
parent97e82764377c6102302d5db8afacd3af53eb69b5 (diff)
Fix memleak in tst_QState::transitions
The QState::removeTransition() call releases ownership of the removed transition, so we need to delete it manually. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I324348af2e63e242e3d9a69fdbd83eefb94bb852 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qstatemachine/qstate/tst_qstate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/qstatemachine/qstate/tst_qstate.cpp b/tests/auto/qstatemachine/qstate/tst_qstate.cpp
index 77f6641..71433c4 100644
--- a/tests/auto/qstatemachine/qstate/tst_qstate.cpp
+++ b/tests/auto/qstatemachine/qstate/tst_qstate.cpp
@@ -175,7 +175,8 @@ void tst_QState::transitions()
QVERIFY(s2.transitions().isEmpty());
s1.removeTransition(t1);
- s1.removeTransition(t1_1);
+ s1.removeTransition(t1_1); // Releases ownership!
+ delete t1_1; // So, delete manually.
QVERIFY(s1.transitions().isEmpty());
s1.addTransition(t1);