diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-02-05 13:18:25 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-02-05 16:21:11 +0000 |
commit | 2ba30fcc069f63153baeb38cd5c57d5639bdc26b (patch) | |
tree | 465f30e0eafce68be09dbb1c0e1e8d5cbf585c6b /src/qml/animations/qanimationjobutil_p.h | |
parent | 81b3675a887e692dbcab33deb0a3bed96fb36b21 (diff) |
QSequentialAnimationGroupJob: Protect against self-deletion
setCurrentAnimation() can indirectly delete the animation group job
itself by invoking the animation controller. Use the RETURN_IF_DELETED
mechanism to avoid the resulting dangling pointers.
Task-number: QTBUG-90401
Change-Id: Ibd0ad21e8d3af4760604c3ff37dc46101d5f49ad
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 680f28b08f65ad38c8d5498b5738231b2a2779a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml/animations/qanimationjobutil_p.h')
-rw-r--r-- | src/qml/animations/qanimationjobutil_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/animations/qanimationjobutil_p.h b/src/qml/animations/qanimationjobutil_p.h index 83cf3b246f..2b7bda3123 100644 --- a/src/qml/animations/qanimationjobutil_p.h +++ b/src/qml/animations/qanimationjobutil_p.h @@ -70,7 +70,7 @@ struct SelfDeletable { // \param func statements or functions that to be executed under test. // \param action post process if p was deleted under test. #define ACTION_IF_DELETED(p, func, action) \ -{ \ +do { \ static_assert(std::is_same<decltype((p)->m_selfDeletable), SelfDeletable>::value, "m_selfDeletable must be SelfDeletable");\ bool *prevWasDeleted = (p)->m_selfDeletable.m_wasDeleted; \ bool wasDeleted = false; \ @@ -82,7 +82,7 @@ struct SelfDeletable { {action;} \ } \ (p)->m_selfDeletable.m_wasDeleted = prevWasDeleted; \ -} +} while (false) #define RETURN_IF_DELETED(func) \ ACTION_IF_DELETED(this, func, return) |