Skip to content

Fix crash when an AppDataStore is released with a notification pending - #605

Open
joshmans wants to merge 1 commit into
mangerlahn:mainfrom
joshmans:pr/fix-appdatastore-unowned-crash
Open

joshmans wants to merge 1 commit into
mangerlahn:mainfrom
joshmans:pr/fix-appdatastore-unowned-crash

Conversation

@joshmans

Copy link
Copy Markdown

The scheduler's event handler in AppDataStore captured self as unowned, runs on a background queue, and sleeps after notifying observers. If the store is released in the meantime, the handler aborts in swift_abortRetainUnowned. The shared store lives for the whole process, so this mostly affects tests that create short-lived stores.

The handler now captures self weakly and returns early.

Adds a regression test that crashes the test process without the change (verified three times) and passes with it.

Based on current main. The only other failure in the suite is VersionParserTest.testEmptyVersionParsing, which already fails on main.

🤖 Generated with Claude Code

The scheduler's event handler captured self as unowned, ran on a background queue
and slept after notifying observers. If the store was released in the meantime the
handler aborted in swift_abortRetainUnowned. The shared store in the app lives for
the whole process, so this mostly shows up in tests that create short-lived stores.

Capture self weakly and return early if the store is gone. Adds a regression test
that crashes the test process without the change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant