<@U015TKX93PD> - should <https://github.com/JetBra...
# compose-desktop
k
@Igor Demin - should https://github.com/JetBrains/androidx/blob/jb-main/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposePanel.desktop.kt#L187 also set
layer
to
null
? Once this method is done, the existing
layer
is marked as disposed, and it’s pretty much unusable from that point on. I do have a rather elaborate scenario where I’m running into
SkiaLayer.needRedraw
crashing - see the full stack trace in thread
Copy code
at org.jetbrains.skiko.SkiaLayer.needRedraw(SkiaLayer.awt.kt:480)
	at androidx.compose.ui.awt.ComposeLayer$scene$1.invoke(ComposeLayer.desktop.kt:152)
	at androidx.compose.ui.awt.ComposeLayer$scene$1.invoke(ComposeLayer.desktop.kt:152)
	at androidx.compose.ui.ComposeScene.invalidateIfNeeded(ComposeScene.skiko.kt:146)
	at androidx.compose.ui.ComposeScene.requestLayout(ComposeScene.skiko.kt:155)
	at androidx.compose.ui.ComposeScene.access$requestLayout(ComposeScene.skiko.kt:90)
	at androidx.compose.ui.ComposeScene$attach$2.invoke(ComposeScene.skiko.kt:249)
	at androidx.compose.ui.ComposeScene$attach$2.invoke(ComposeScene.skiko.kt:249)
	at androidx.compose.ui.platform.SkiaBasedOwner.onRequestMeasure(SkiaBasedOwner.skiko.kt:293)
	at androidx.compose.ui.node.Owner.onRequestMeasure$default(Owner.kt:149)
	at androidx.compose.ui.node.LayoutNode.requestRemeasure$ui(LayoutNode.kt:1120)
	at androidx.compose.ui.node.LayoutNode.requestRemeasure$ui$default(LayoutNode.kt:1117)
	at androidx.compose.ui.node.LayoutNode.invalidateMeasurements$ui(LayoutNode.kt:1149)
	at androidx.compose.ui.node.LayoutNode.detach$ui(LayoutNode.kt:415)
	at androidx.compose.ui.node.LayoutNode.onChildRemoved(LayoutNode.kt:314)
	at androidx.compose.ui.node.LayoutNode.removeAll$ui(LayoutNode.kt:307)
	at androidx.compose.ui.platform.DefaultUiApplier.onClear(DefaultUiApplier.skiko.kt:42)
	at androidx.compose.runtime.AbstractApplier.clear(Applier.kt:213)
	at androidx.compose.runtime.CompositionImpl.dispose(Composition.kt:595)
	at androidx.compose.ui.ComposeScene.close(ComposeScene.skiko.kt:228)
	at androidx.compose.ui.awt.ComposeLayer.dispose(ComposeLayer.desktop.kt:381)
	at androidx.compose.ui.awt.ComposePanel.removeNotify(ComposePanel.desktop.kt:186)
	at java.desktop/java.awt.Container.removeNotify(Container.java:2831)
	at java.desktop/javax.swing.JComponent.removeNotify(JComponent.java:4801)
	at java.desktop/java.awt.Container.removeAll(Container.java:1322)
	at java.desktop/javax.swing.Popup.hide(Popup.java:130)
	at java.desktop/javax.swing.PopupFactory$HeavyWeightPopup.hide(PopupFactory.java:529)
	at java.desktop/javax.swing.JPopupMenu.setVisible(JPopupMenu.java:789)
In here, I’m putting a
ComposePanel
into a Swing’s
JPopupMenu
And the crash happens when I call
JPopupMenu.setVisible(false)
i
Sorry for the late response. Yes, we should set
layer
to null in ComposePanel (I will change this). But according to the exception, that won’t fix the issue, because the exception happens inside
layer.dispose
, not after it, when we will nullify
layer
. Could you provide a stack trace with the exception message, and maybe a part of the code?
k
Sure, let me see if I can reproduce this in a standalone sample