mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Fix status bar crash at midnight
NSCalendarDayChanged is posted from a background queue (CoreFoundation's
__postAndResetMidnight), but MainWindowStatusBarView's handler for it was
main-actor isolated, so Swift's executor check trapped with EXC_BREAKPOINT
at 00:00 every night the app was running. The time zone and locale change
handlers have the same shape, so they get the same treatment: nonisolated,
hopping to the main actor before updating the count label. SmartFeed
already handles NSCalendarDayChanged this way.
The crash came in with the last-refresh time in the status bar (e4eefa31d).
This commit is contained in:
1 parent
59c0afe4a9
commit
b17800e28f
1 file changed
+13
-6
@@ -215,16 +215,23 @@ final class MainWindowStatusBarView: NSView {
|
||||
}
|
||||
|
||||
// The last refresh time shows the date only when it’s not today, so it changes at midnight.
|
||||
@objc func handleCalendarDayChanged(_ notification: Notification) {
|
||||
updateCountLabel()
|
||||
// These system notifications aren’t guaranteed to arrive on the main thread.
|
||||
@objc nonisolated func handleCalendarDayChanged(_ notification: Notification) {
|
||||
Task { @MainActor in
|
||||
self.updateCountLabel()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func handleCurrentLocaleDidChange(_ notification: Notification) {
|
||||
updateCountLabel()
|
||||
@objc nonisolated func handleCurrentLocaleDidChange(_ notification: Notification) {
|
||||
Task { @MainActor in
|
||||
self.updateCountLabel()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func handleSystemTimeZoneDidChange(_ notification: Notification) {
|
||||
updateCountLabel()
|
||||
@objc nonisolated func handleSystemTimeZoneDidChange(_ notification: Notification) {
|
||||
Task { @MainActor in
|
||||
self.updateCountLabel()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func handleArticleThemeNamesDidChange(_ notification: Notification) {
|
||||
|
||||
Reference in new issue
Block a user