Unverified Commit 2dd06f0a authored by Elijah Semyonov's avatar Elijah Semyonov Committed by GitHub

Fix memory leak on iOS (#789)

* Fix memory leak on iOS

* Add check for caDisplayLink being disposed before drawing

* Add logger warn
parent 7670c518
......@@ -50,6 +50,10 @@ actual open class SkiaLayer {
actual fun detach() {
view?.detach()
// GC bug? fixes leak on iOS
view = null
skikoView = null
}
actual var skikoView: SkikoView? = null
......
......@@ -101,6 +101,11 @@ internal class MetalRedrawer(
}
private fun draw() {
if (caDisplayLink == null) {
Logger.warn { "caDisplayLink callback called after it was invalidated "}
return
}
autoreleasepool {
val (width, height) = metalLayer.drawableSize.useContents {
width.roundToInt() to height.roundToInt()
......
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