Skip to content

AnimationComponent: Unwrap old constraint if complete - #181

Merged
Johni0702 merged 1 commit into
masterfrom
fix/animation-constraints-unwrapping
Jul 27, 2026
Merged

AnimationComponent: Unwrap old constraint if complete#181
Johni0702 merged 1 commit into
masterfrom
fix/animation-constraints-unwrapping

Conversation

@Johni0702

Copy link
Copy Markdown
Contributor

This fixes stack overflow errors (and increasingly worse performance) when (even short-lived) animations are stacked on top of each other.

The current animation system naturally stacks multiple animation constraints on top of each other, it however only unwraps completed animation constraints when the top-most one is completed (in AnimatingConstraints.updateCompletion). By e.g. continuously scrolling a ScrollComponent up and down via its scrollbar, such that there's no 0.1s without new input, this animation stack will there grow indefinitely and eventually result in a StackOverflowError (on my machine after ~40s, slowly halfing FPS in the process).

This commit fixes this issue by having each animation constraint internally unwrap its oldConstraint when that is done, thereby keeping the effective animation stack flat. The oldConstraint property itself is not modified, since it is public API.

This fixes stack overflow errors (and increasingly worse performance)
when (even short-lived) animations are stacked on top of each other.

The current animation system naturally stacks multiple animation
constraints on top of each other, it however only unwraps completed
animation constraints when the top-most one is completed (in
`AnimatingConstraints.updateCompletion`). By e.g. continuously scrolling
a ScrollComponent up and down via its scrollbar, such that there's no
0.1s without new input, this animation stack will there grow
indefinitely and eventually result in a StackOverflowError (on my
machine after ~40s, slowly halfing FPS in the process).

This commit fixes this issue by having each animation constraint
internally unwrap its `oldConstraint` when that is done, thereby keeping
the effective animation stack flat. The `oldConstraint` property itself
is not modified, since it is public API.
@Johni0702
Johni0702 merged commit aa50227 into master Jul 27, 2026
1 check passed
@Johni0702
Johni0702 deleted the fix/animation-constraints-unwrapping branch July 27, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants