From b17800e28fb1d85869dd67d03d223a09f7d564e9 Mon Sep 17 00:00:00 2001 From: Dave Marquard Date: Thu, 22 Oct 2026 10:20:39 -0700 Subject: [PATCH] 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). --- .../StatusBar/MainWindowStatusBarView.swift | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Mac/MainWindow/StatusBar/MainWindowStatusBarView.swift b/Mac/MainWindow/StatusBar/MainWindowStatusBarView.swift index 4a5fd0f6e..4536f99fa 100644 --- a/Mac/MainWindow/StatusBar/MainWindowStatusBarView.swift +++ b/Mac/MainWindow/StatusBar/MainWindowStatusBarView.swift @@ -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) {