Skip to content

Commit c9a9ead

Browse files
committed
Force a draw pass when a layer is detached
1 parent 98b92bb commit c9a9ead

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/BaseComposeScene.skiko.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,15 @@ internal abstract class BaseComposeScene(
8282
}
8383
}
8484

85-
protected fun invokeInvalidationCallbacks() {
85+
protected fun invokeInvalidationCallbacks(
86+
forceLayout: Boolean = false,
87+
forceDraw: Boolean = false,
88+
) {
8689
if (isInvalidationDisabled || isClosed || composition == null) return
87-
if (hasPendingMeasureOrLayout) {
90+
if (forceLayout || hasPendingMeasureOrLayout) {
8891
invalidateLayout()
8992
}
90-
if (hasPendingDraw) {
93+
if (forceDraw || hasPendingDraw) {
9194
invalidateDraw()
9295
}
9396
}

compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/scene/CanvasLayersComposeScene.skiko.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,9 @@ private class CanvasLayersComposeSceneImpl(
528528
onOwnerRemoved(layer.owner)
529529

530530
inputHandler.onPointerUpdate()
531-
invokeInvalidationCallbacks()
531+
// Removing a layer changes the scene's composited output (e.g. it removes a dialog scrim)
532+
// without dirtying any remaining owner, so force a draw pass to repaint without it.
533+
invokeInvalidationCallbacks(forceDraw = true)
532534
}
533535

534536
private fun requestFocus(layer: AttachedComposeSceneLayer) {

0 commit comments

Comments
 (0)