Repository navigation
fix: keep a package library that outlives its bar from crashing the test run - #481
Conversation
…est run PackageLibrary held its BarStore unowned, but the update check's task, or a view's @State, can keep the library alive after the store is gone. When the update check resumed after a test had released its store, syncSources() read the destroyed store and aborted the whole Swift Testing run. The library now holds the store weakly and leaves the bar alone once it's gone. Fixes #480
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
Before and after
50 unchanged screens
Visual review: 50 screens, none changed. |
#481 replaced PackageLibrary's unowned store with a weak one, so its allowance drops to 0 and a new unowned reference there fails the test.
## [0.12.0](v0.11.0...v0.12.0) (2026-11-10) ### Features * ask for the permissions your bar needs before setup uses them ([#442](#442)) ([9494cc7](9494cc7)), closes [#441](#441) * let a group's top corners curve outward into the top of the screen ([265eb90](265eb90)) * paint the notch black so screen shares and screenshots match the display ([c40dda3](c40dda3)) * set widget, popup and tooltip backgrounds separately ([7eaf5af](7eaf5af)) * show Rift workspaces in workspace widgets ([d0f6d4d](d0f6d4d)) * turn on Open at login when setup replaces the menu bar ([#507](#507)) ([d24abe1](d24abe1)) ### Bug Fixes * ask before Skip setup throws away the choices made so far ([#470](#470)) ([66f47ea](66f47ea)), closes [#454](#454) * ask where the bar goes first, and for permissions after the choices ([#492](#492)) ([1f45416](1f45416)), closes [#450](#450) * drop a window that left every workspace when clicking it fails ([ec45fcc](ec45fcc)), closes [#520](#520) * drop stray focus rings and show popup focus in the theme's hover look ([61ea306](61ea306)) * fall back to macOS Spaces when no window manager is running ([#436](#436)) ([5cc4ef2](5cc4ef2)), closes [#435](#435) [#435](#435) * give a bar below the menu bar what the menu bar doesn't show ([#469](#469)) ([1181904](1181904)), closes [#452](#452) * hold Edit Bar in Place until setup is done ([7582976](7582976)), closes [#462](#462) * keep a bar below the menu bar clear of it on every display ([#468](#468)) ([ff1d0e9](ff1d0e9)), closes [#451](#451) * keep a cancelled hover from showing a tooltip or closing its popup late ([#483](#483)) ([93c44a1](93c44a1)), closes [#482](#482) * keep a package library that outlives its bar from crashing the test run ([#481](#481)) ([5f4821d](5f4821d)), closes [#480](#480) * keep a popup's focus when clicking inside it ([f5ecaec](f5ecaec)) * keep setup's buttons above a Dock at the bottom of the screen ([#445](#445)) ([2784139](2784139)), closes [#444](#444) * keep setup's pointer below the bar when the menu bar shows ([#509](#509)) ([ef22935](ef22935)) * keep setup's steps, reminders and hints readable on short screens ([#476](#476)) ([940777d](940777d)), closes [#455](#455) * keep the app menus on the menu bar's app while a background agent is in front ([#446](#446)) ([a900ef5](a900ef5)), closes [#443](#443) * keep the app menus that fit beside the notch and put the rest behind » ([#477](#477)) ([8b09465](8b09465)), closes [#453](#453) * keep the focus ring while editing the bar ([80195ff](80195ff)) * keep widgets beside the notch against it when More widgets shows its button ([d74b925](d74b925)) * leave Battery out of setup's presets on a Mac without a battery ([3db935d](3db935d)), closes [#456](#456) * let Skip setup restore the menu bar when a change is still in flight ([#498](#498)) ([9fdf1ce](9fdf1ce)), closes [#497](#497) * look up private macOS calls at runtime, so a missing one only turns its feature off ([#490](#490)) ([5f312fd](5f312fd)) * move a bar an earlier setup put below the menu bar under it ([#475](#475)) ([9cada9a](9cada9a)), closes [#468](#468) [#474](#474) * name the profile that sets belowMenuBar in setup's profile notice ([#473](#473)) ([55aea3c](55aea3c)), closes [#471](#471) * offer the Notch preset only when the bar replaces the menu bar ([#438](#438)) ([dc5a611](dc5a611)), closes [#437](#437) * reject a negative group flare ([eae8615](eae8615)) * show workspace managers as segments in Settings again ([60e21a5](60e21a5)) * start a new bar with a clock in the Mac's date order and 12- or 24-hour time ([#501](#501)) ([ed119f7](ed119f7)) * stop reopening setup at every launch after Skip setup ([#472](#472)) ([a15e07a](a15e07a)), closes [#449](#449)
|
🎉 This PR is included in version 0.12.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Problem
Fixes #480.
swift testsometimes aborts with "Attempted to read an unowned reference but the object was already destroyed", which ends the whole Swift Testing run. It failed 7 CI runs since 2026-10-23, four of them pushes tomainthat then published no beta. A local crash report gave the stack: the package update check's task, inPackageLibrary.syncSources().Changes
PackageLibraryholds itsBarStoreweakly instead ofunowned. Its update check (after 15 seconds, then hourly) runs in a task that keeps the library alive while it waits for the package client, andPackagesViewkeeps a library in@State; either can outlive the store. A library whose bar is gone now leaves it alone: actions that edit the bar return without doing anything, and read-only helpers fall back to the defaults they already had ([.store],0,nil,false).PackageLibraryLifetimeTestsreproduces the crash: it releases the store, then runs the work the update check runs.BarEditing,ConfigurationHistoryand the pinned popups also hold an unownedBarStore, but no crash points at them. A later change that forbidsunownedwill convert them with their own tests.Testing
PackagesViewTests,PackageStoreClientTests,PackageSourceLinkTests) pass, except one test named below.testCommandPackageReviewLoadsInAnUnorderedWindowandtestCommandReviewLoadsInsidePopoverIncludingRequirementsAndSettingswait 300 ms for a review to load, and failed 3 of 3 runs onmain'sPackageLibrarytoo.pinnedPopupsStayOnScreenAndReturnUnderTheirWidgetdepends on the displays. CI doesn't report any of them.Merging
One commit; any merge method works.
Claude Opus 5.5 via Claude Code