diff --git a/integration/compose/src/main/java/com/bumptech/glide/integration/compose/Transition.kt b/integration/compose/src/main/java/com/bumptech/glide/integration/compose/Transition.kt index 8b30e0bfa9..3fc938d205 100644 --- a/integration/compose/src/main/java/com/bumptech/glide/integration/compose/Transition.kt +++ b/integration/compose/src/main/java/com/bumptech/glide/integration/compose/Transition.kt @@ -12,6 +12,8 @@ import androidx.compose.ui.graphics.drawscope.DrawScope import androidx.compose.ui.graphics.drawscope.clipRect import androidx.compose.ui.graphics.drawscope.translate import androidx.compose.ui.graphics.painter.Painter +import kotlinx.coroutines.NonCancellable +import kotlinx.coroutines.withContext /** * Transition between a given request's optional placeholder and the resource. @@ -141,7 +143,9 @@ internal class CrossFadeImpl( animatable.animateTo(OPAQUE_ALPHA, animationSpec) invalidate() } finally { - animatable.snapTo(OPAQUE_ALPHA) + withContext(NonCancellable) { + animatable.snapTo(OPAQUE_ALPHA) + } invalidate() } } @@ -161,4 +165,4 @@ internal class CrossFadeImpl( draw(size, animatable.value * alpha, colorFilter) } } -} \ No newline at end of file +}