[go: nahoru, domu]

Don't crash during invalidation

Fixes: 246239483

I wasn't able to reproduce the problem causing the crash,
but the requires() line does not need to be present for
the invalidation to work. I've removed the requres() and
removed the layer from postponedDirtyLayers as well when
a layer is marked as not dirty.

Test: None. I can't reproduce this bug.

Change-Id: I6a1ee7efe37de66383d10838ad0d592f2df380c4
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
index a29e428..0b64d42 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
@@ -1038,7 +1038,10 @@
         if (!isDirty) {
             // It is correct to remove the layer here regardless of this if, but for performance
             // we are hackily not doing the removal here in order to just do clear() a bit later.
-            if (!isDrawingContent) require(dirtyLayers.remove(layer))
+            if (!isDrawingContent) {
+                dirtyLayers.remove(layer)
+                postponedDirtyLayers?.remove(layer)
+            }
         } else if (!isDrawingContent) {
             dirtyLayers += layer
         } else {