Repository navigation
Fix CanvasLayoutStore teardown crash on older Swift runtimes - #837
Merged
Merged
Conversation
This fix is too small for a durable docs-ai record. The pull request keeps the rationale.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an explicit empty
nonisolated deinittoCanvasLayoutStoreto avoid the TaskLocal invalid-free crash in older system Swift concurrency runtimes (Sentry PROWL-MACOS-KB / PROWL-MACOS-KC).Root cause
Under the default main-actor isolation, the compiler infers an isolated deinit for
CanvasLayoutStore. Its destructor callsswift_task_deinitOnExecutor. On older system runtimes (for example macOS 26.3.1), a synchronous release while TaskLocal storage is bound hits the invalid free fixed upstream in swiftlang/swift#85204. The fix is in the runtime, so a newer Xcode does not help: the app links the systemlibswift_Concurrency.dylib.The published 2026.9.25 build (Xcode 27,
27A266a) still branches toswift_task_deinitOnExecutorfrom theCanvasLayoutStoreheap destructor.The store has no actor-bound teardown work. Persistence happens on mutation, not on destruction. State access stays main-actor isolated.
Changes
CanvasLayoutStore: explicit emptynonisolated deinit.CanvasLayoutStoreTests: release the store synchronously on a main-queue callback (no current Task) with a live TaskLocal binding. Check lifetime, binding restoration, and persistence.Validation
swift_task_deinitOnExecutorImpl/ invalid-free stack; patched source completes 10,000 releases outside a Task.swift_task_deinitOnExecutor; patched destructor does not.make build-app,make check, and all 5CanvasLayoutStoreTestspass (Xcode 26.6).Not yet verified
onevtail - an assistant to @onevcat