We're facing a reproducible crash on iOS 17 that seems to be related to our ToolbarItems. It happens when we tear down a NavigationStack (by setting all navigationDestination Bindings to false), where the same view is present multiple times in the stack.
This happens in about 20% of the time and only on a real iOS device:
Simultaneous accesses to 0x144a23a60, but modification requires exclusive access. Previous access (a modification) started at SwiftUI` + 12312 (0x1a5595a34).
The stacktrace goes from [UIBarButtonItem dealloc] -> AG::Subgraph::notify_observers() -> swift::runtime::AccessSet::insert(swift::runtime::Access*, void*, void*, swift::ExclusivityFlags)
The "Current access (a read) started at:" info points to a very similar stacktrace (see the screenshot I linked below).
I failed to attach the crash report to this post, but have uploaded it here: https://www.dropbox.com/scl/fi/7lrwkuhge0dmz1grv9r3r/SwiftUI-ToolbarItem-Crash.txt?rlkey=pu0x835y25uy38r605qflhhtm&dl=0.
This is the Stacktrace from Xcode:
https://www.dropbox.com/scl/fi/fdijajvq60jd7wawlsdjr/SwiftUI-ToolbarItem-Crash.png?rlkey=m05ahqihliji32udbcmd6yz0a&dl=0
Is there anything I can do to narrow down the root cause? A workaround would be to remove the ToolbarItems and fake a navigation controller, but I would like to avoid such hacks.
10
5
3.3k