Repository navigation
Description
What happens
swift test sometimes aborts with Fatal error: Attempted to read an unowned reference but the object was already destroyed (signal 6), which ends the whole Swift Testing run. It has failed 7 CI runs since 2026-10-23, including pushes to main on 10-28, 10-31, 11-04 and 11-07; a red main push publishes no beta. It also crashed a local run on 2026-11-08.
Steps to reproduce
In a test: create a BarStore, keep its packageLibrary, release the store, then run the library's update work with await library.loadInstalled(). It aborts in PackageLibrary.syncSources() every time.
On CI it takes a test whose store started at least 15 seconds earlier and that ends while the update check waits for its client, which only happens on a busy runner.
Expected
A package library that outlives its bar skips the work that needs the bar, without crashing.
Environment
CI (macos-26, Xcode 26.6, Swift 6.3.3) and a local run (macOS 27.2, Xcode 27.2, Swift 6.4.2). The app keeps one BarStore for as long as it runs, so this is unlikely to reach people using the bar; it breaks test runs.
Evidence
Local crash report, main thread:
swift::swift_abortRetainUnowned(void const*)
swift_unknownObjectUnownedLoadStrong
PackageLibrary.syncSources() PackageLibrary.swift:370
PackageLibrary.configurationChanged() PackageLibrary.swift:348
PackageLibrary.loadInstalled() PackageLibrary.swift:392
closure in PackageLibrary.startUpdateChecks() PackageLibrary.swift:101
CI runs that crashed this way: 39972162112, 40309333232, 40674033525, 41084374463, 41218427956, 41826138923, 42375992589.
Diagnosis
PackageLibrary holds private unowned let store: BarStore (Sources/StableBar/PackageLibrary.swift:36), which promises that the store outlives the library. It doesn't always:
BarStore.start()callspackageLibrary.startUpdateChecks(), whose timer fires after 15 seconds, then hourly. Its task holds the library while it waits forclient.installed(). When the store is released meanwhile,loadInstalled()resumes intoconfigurationChanged()andsyncSources(), which read the destroyed store.PackagesViewkeeps a library in@State, which can also outlive the store.
WidgetPopup already holds its store weakly (private weak var store: BarStore?).
Related
- Notify about package updates with a dismissible bar button #146 and feat: notify about package updates in the bar #153 (542c8dc, first released in v0.6.0) added the update checks.
BarEditing,ConfigurationHistoryand the pinned popups inWidgetPopup.swiftalso hold an unownedBarStore; no crash points at them so far.
Triaged by Claude Code (Claude Opus 5.5).
Activity
chore(release): 0.12.0 [skip ci]
stablebar-releases commentedon Nov 10, 2026
🎉 This issue has been resolved in version 0.12.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀