diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-06-02 08:50:35 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-06-02 16:45:23 +0200 |
commit | d5ab0101ffaaa36ccefda80e3a7a1eb5c60070d5 (patch) | |
tree | 0e64c05118d0b48f2cb0aa64880eaede78c7e7ce /tests/auto/corelib | |
parent | 78ed8034d24a4914c01546db188aa4832c71d551 (diff) |
Avoid use after free in tst_qsequentialanimationgroup
The test connects finished to the groups clear method, which in turn
deletes the animation instance. Thus, no member must be accessed after
calling stop, unless we use a (costly) QPointer to guard against
deletion.
Notify earlier that totalCurrentTime changed to avoid the issue.
As a drive-by, modernize the connect in the test.
Fixes: QTBUG-94143
Change-Id: I923101107b7f79115be69a58c8e8d5177a98d48f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 43a8593803..779b225bfb 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -1614,7 +1614,7 @@ void tst_QSequentialAnimationGroup::clear() { SequentialAnimationGroup group; QPointer<QAbstractAnimation> anim1 = new DummyPropertyAnimation(&group); - group.connect(anim1, SIGNAL(finished()), SLOT(clear())); + connect(anim1, &QAbstractAnimation::finished, &group, &QSequentialAnimationGroup::clear); new DummyPropertyAnimation(&group); QCOMPARE(group.animationCount(), 2); |