diff --git a/DuckDuckGo/Tab/View/WebViewContainerView.swift b/DuckDuckGo/Tab/View/WebViewContainerView.swift index e87e18f677..e75c81c627 100644 --- a/DuckDuckGo/Tab/View/WebViewContainerView.swift +++ b/DuckDuckGo/Tab/View/WebViewContainerView.swift @@ -141,21 +141,23 @@ final class WebViewContainerView: NSView { } .store(in: &cancellables) - fullScreenWindowWillCloseCancellable = NotificationCenter.default.publisher(for: NSWindow.willCloseNotification, object: fullScreenWindow) - .sink { [weak self] notification in - self?.fullScreenWindowWillCloseCancellable = nil - let fullScreenWindowController = (notification.object as? NSWindow)?.windowController - DispatchQueue.main.async { [weak fullScreenWindowController] in - guard let fullScreenWindowController else { return } - // just in case. - // if WKFullScreenWindowController receives `close()` the next time it‘s open it will crash because its _webView is nil - // https://errors.duckduckgo.com/organizations/ddg/issues/3411/?project=6&referrer=release-issue-stream - NSException.try { - fullScreenWindowController.setValue(NSView(), forKeyPath: #keyPath(webView)) + // https://app.asana.com/0/72649045549333/1206959015087322/f + if #unavailable(macOS 14.4) { + fullScreenWindowWillCloseCancellable = NotificationCenter.default.publisher(for: NSWindow.willCloseNotification, object: fullScreenWindow) + .sink { [weak self] notification in + self?.fullScreenWindowWillCloseCancellable = nil + let fullScreenWindowController = (notification.object as? NSWindow)?.windowController + DispatchQueue.main.async { [weak fullScreenWindowController] in + guard let fullScreenWindowController else { return } + // just in case. + // if WKFullScreenWindowController receives `close()` the next time it‘s open it will crash because its _webView is nil + // https://errors.duckduckgo.com/organizations/ddg/issues/3411/?project=6&referrer=release-issue-stream + NSException.try { + fullScreenWindowController.setValue(NSView(), forKeyPath: #keyPath(webView)) + } } - } - } + } }