Skip to content

Commit

Permalink
Offscreen, Linux. Fix native crash when OpenGL isn't available (#877)
Browse files Browse the repository at this point in the history
Instead, fallback to Software.

Discovered during #876
investigation

## Explanation

We throw RenderException, and Fallback mechanism catches it and switches
to Software

## Testing

1. Setup the system without OpenGL
2. Run SkiaSwingLayer
3. See the native crash
  • Loading branch information
igordmn authored Feb 26, 2024
1 parent c0f0152 commit 20f8941
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ internal class LinuxOpenGLSwingRedrawer(

private val swingOffscreenDrawer = SwingOffscreenDrawer(swingLayerProperties)

private val offScreenContextPtr: Long = makeOffScreenContext()
private val offScreenContextPtr: Long = makeOffScreenContext().also {
if (it == 0L) {
throw RenderException("Cannot create OpenGL context")
}
}


private var offScreenBufferPtr: Long = 0L

Expand Down

0 comments on commit 20f8941

Please sign in to comment.