Skip to content

Commit

Permalink
Disable encoding on separate thread for iOS (#907)
Browse files Browse the repository at this point in the history
## Proposed Changes

Using Skia context in multiple threads simultaneously leads to
occasional unreproducable crashes on users' side.
Roll back experimental #896. Disable the path for encoding rendering
commands on a separate thread until the scenario is resolved and
underlying issue is fixed.

## Testing

Test: N/A

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#3862
  • Loading branch information
elijah-semyonov authored and igordmn committed Nov 20, 2023
1 parent b4f91f9 commit 329e000
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ internal class MetalRedrawer(
isForcedToPresentWithTransactionEveryFrame || interopTransaction.isNotEmpty()
metalLayer.presentsWithTransaction = presentsWithTransaction

val mustEncodeAndPresentOnMainThread = presentsWithTransaction || waitUntilCompletion
// TODO: encoding on separate thread requires investigation for reported crashes
// https://github.com/JetBrains/compose-multiplatform/issues/3862
// https://youtrack.jetbrains.com/issue/COMPOSE-608/iOS-reproduce-and-investigate-parallel-rendering-encoding-crash
// val mustEncodeAndPresentOnMainThread = presentsWithTransaction || waitUntilCompletion
val mustEncodeAndPresentOnMainThread = true

val encodeAndPresentBlock = {
surface.canvas.drawPicture(picture)
Expand Down

0 comments on commit 329e000

Please sign in to comment.