I’m trying to display Compose ui elements on top o...
# compose-desktop
s
I’m trying to display Compose ui elements on top of a SwingPanel. When I enable
compose.interop.blending
as specified in the documentation, my app crashes on launch with a SIGTRAP:
Copy code
Crashed Thread:        29  Java: AWT-EventQueue-0

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x00000001937bdbf4

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [66685]

Application Specific Information:
Must only be used from the main thread
Full crash report in 🧵
Full crash report
Relevant bit of the stack trace:
Copy code
Thread 29 Crashed:: Java: AWT-EventQueue-0
0   AppKit                        	       0x1937bdbf4 -[NSWMWindowCoordinator performTransactionUsingBlock:] + 768
1   AppKit                        	       0x1935ed6a4 -[NSWindow(NSWMWindowManagement) window:didUpdateWithChangedProperties:] + 104
2   WindowManagement              	       0x2671bcf60 -[_WMWindow performUpdatesUsingBlock:] + 116
3   WindowManagement              	       0x2671bc3f0 -[_WMWindow setShadowProperties:] + 144
4   AppKit                        	       0x192bddaa0 _NSWindowSetShadowProperties + 692
5   libskiko-macos-arm64.dylib    	       0x1493fdfc0 Java_org_jetbrains_skiko_redrawer_MetalRedrawer_createMetalDevice + 724
Filed youtrack https://youtrack.jetbrains.com/issue/CMP-7352/SIGTRAP-from-AppKit-when-compose.interop.blending-is-enabled But the repro is so simple, I’m wondering if I’m just doing something wrong:
Copy code
fun main() {
  System.setProperty("compose.interop.blending", "true")
  singleWindowApplication { Box {} }
}
s
Abnormal conditions that are a developer's fault should trigger a controlled exception (potentially with a useful error message). Given this is a native crash, I'd assume it's a bug, most likely in Compose (Skia/Skiko) or the JVM (Swing).
m
Would the mentioned workaround here be an option for you?
s
That issue doesn't seem related. I'm getting a crash even before adding a SwingPanel. Just setting the flag triggers a crash.
m
I meant this workaround to render into an image. Then you won’t need the flag. I once did something similar for JavaFX.
s
Ah I see. If I render the image into a SwingPanel I'd still need blending. Maybe I could render the image straight into compose somehow. Or if there's some solution out there for a transparent ComposePanel, I could place that in the SwingPanel over the map. I've experimented quite a bit and haven't been able to get a transparent ComposePanel to work though