From 48776eae5ebfa5a1e7c2a794c0485426744bb4fa Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 13 Oct 2026 15:44:27 -0700 Subject: [PATCH] Simplify splitview observsation. --- Mac/MainWindow/MainWindowController.swift | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index 754714bf0..710ebe57f 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -74,8 +74,6 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations private var restoreArticleWindowScrollY: CGFloat? // Holds the split view controller and the status bar. private let mainWindowContentViewController = MainWindowContentViewController() - // The split view whose resizing the status bar tracks. - private weak var observedSplitView: NSSplitView? private var mouseoverLink: String? { didSet { updateStatusBarLink() @@ -1881,12 +1879,9 @@ private extension MainWindowController { /// Tracks the sidebar divider in the status bar. Call after the split view controller is replaced. func observeSplitViewForStatusBar() { - if let observedSplitView { - NotificationCenter.default.removeObserver(self, name: NSSplitView.didResizeSubviewsNotification, object: observedSplitView) - } - observedSplitView = splitViewController?.splitView - if let observedSplitView { - NotificationCenter.default.addObserver(self, selector: #selector(handleSplitViewDidResizeSubviews(_:)), name: NSSplitView.didResizeSubviewsNotification, object: observedSplitView) + NotificationCenter.default.removeObserver(self, name: NSSplitView.didResizeSubviewsNotification, object: nil) + if let splitView = splitViewController?.splitView { + NotificationCenter.default.addObserver(self, selector: #selector(handleSplitViewDidResizeSubviews(_:)), name: NSSplitView.didResizeSubviewsNotification, object: splitView) } updateStatusBarSidebarDivider() }