Repository navigation
fix: prevent isolated deinit crashes during Markdown rendering - #17
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
gtokman
marked this pull request as ready for review
October 19, 2026 16:29
This branch was successfully deployed
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
Prevent synchronous Markdown rendering from aborting during helper teardown on older Swift runtimes, extending the lifetime fix in #16.
Problem
BlockProcessor,TextBuilder, andReusableViewProviderstill receive implicit isolated deinitializers under the package's default MainActor isolation. Releasing them synchronously outside a Swift task can enterswift_task_deinitOnExecutorMainActorBackDeploy→swift_task_deinitOnExecutorImpl→TaskLocal::StopLookupScopeand abort with “pointer being freed was not allocated.” This matches Swift issue #88036.The unmodified library reproduced this crash independently for all three classes on the iOS 26.2 simulator.
Solution
Add explicit empty
nonisolated deinitimplementations to those three classes, preserving MainActor isolation for their rendering operations. Extend the existing synchronous task-local lifetime tests to cover each helper and complete full/incremental renders, including release of the owned view provider.Validation
swift test --filter RenderingLifetimeTests: seven tests passed on macOS.MarkdownViewtarget for the iOS simulator passed.git diff --checkpassed. Noxcodebuildor full app build was run.The consuming app's dependency pin must be updated separately after this fix is available.
CI follow-up
The initial Swift workflow compiled successfully but failed two existing highlighting assertions: their Python/Swift grammars are optional and excluded from the default package traits. Use JavaScript fixtures for those tests and the highlight-cache test, and require a nonempty map before checking cache reuse. This preserves highlighting coverage under the default configuration.
Validation after the fixture correction:
swift buildand the fullswift testsuite pass locally (166 tests, zero failures).