Commit d30b465d authored by Igor Demin's avatar Igor Demin

Fix crash on dispose window (macOs) 2

parent 2463e751
......@@ -14,12 +14,15 @@ internal class MacOsRedrawer(
) : Redrawer {
private val containerLayerPtr = initContainer(layer)
private val drawLock = Any()
private var isDisposed = false
private val drawLayer = object : AWTGLLayer(containerLayerPtr, setNeedsDisplayOnBoundsChange = true) {
override fun draw() = synchronized(drawLock) {
if (!isDisposed) {
layer.draw()
}
}
}
// use a separate layer for vsync, because with single layer we cannot asynchronously update layer
// `update` is suspend, and runBlocking(Dispatchers.Swing) causes dead lock with AppKit Thread.
......@@ -80,6 +83,7 @@ internal class MacOsRedrawer(
frameDispatcher.cancel()
vsyncLayer.dispose()
drawLayer.dispose()
isDisposed = true
}
override fun syncSize() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment