summaryrefslogtreecommitdiffstats
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 09:29:57 +0000
commitdf13f01741a9c78ba2f5858c39e0c38a858e2438 (patch)
tree80e8b689b8c871c0e796b8d875ec56ad0ecc70f2
parent25cb3a9e7edd8d79f2cd0b79b29e71f3d536e8d0 (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.5 6.2 5.15 Change-Id: I324348af2e63e242e3d9a69fdbd83eefb94bb852 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> (cherry picked from commit 4dfb02932c5569f7430017ba0b77c527e51c9456) Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-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);