diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2023-10-04 17:10:26 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-10-05 12:54:35 +0000 |
commit | b0490330a6ca971a0cc775cfff91e032ddb818a5 (patch) | |
tree | 9fcf62a98ab341da29a7e4fd0137b254cddb3a3e | |
parent | 5495b20b67e66066773ed3e09915013876c8e0f5 (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.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>
(cherry picked from commit df13f01741a9c78ba2f5858c39e0c38a858e2438)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tests/auto/qstatemachine/qstate/tst_qstate.cpp | 3 |
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); |