Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition.kt invokes cancellable suspend function in finally clause #5278

Closed
kanelbulle opened this issue Sep 14, 2023 · 0 comments · Fixed by #5279
Closed

Transition.kt invokes cancellable suspend function in finally clause #5278

kanelbulle opened this issue Sep 14, 2023 · 0 comments · Fixed by #5279

Comments

@kanelbulle
Copy link
Collaborator

animatable.snapTo(OPAQUE_ALPHA) is suspending, and should not be invoked in the finally clause, since if the coroutine has been cancelled, any call to a suspending function will immediately throw CancellationException, thus not performing the final animation move cleanup.

This can be fixed by invoking the suspending function non-cancellable:

  withContext(NonCancellable) {
    animatable.snapTo(OPAQUE_ALPHA)
  }
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 a pull request may close this issue.

1 participant