Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 9b8a9a91f89a409307d1803534b425a6dec47aa3 https://github.com/WebKit/WebKit/commit/9b8a9a91f89a409307d1803534b425a6dec47aa3 Author: Ryosuke Niwa <rn...@webkit.org> Date: 2024-04-17 (Wed, 17 Apr 2024)
Changed paths: M Source/WebKit/UIProcess/mac/WebViewImpl.mm Log Message: ----------- Make WKWindowVisibilityObserver more robust https://bugs.webkit.org/show_bug.cgi?id=272605 <rdar://125534586> Reviewed by Sihui Liu and Wenson Hsieh. This PR makes WKWindowVisibilityObserver more robust by remembering the observed NSWindow and automatically stop observing NSWindow in dealloc, startObserving, and ~WebViewImpl. Always unregister KVO from the shared font panel if _shouldObserveFontPanel is set to YES in stopObserving before exiting early for _window being nil. This fixes Mail's top crasher. This PR also deploys __weak and WeakPtr to WKWindowVisibilityObserver to safe guard against any kind of use-after-free bugs. Also assert that we're on the main thread in various places. * Source/WebKit/UIProcess/mac/WebViewImpl.mm: (-[WKWindowVisibilityObserver initWithView:impl:]): (-[WKWindowVisibilityObserver dealloc]): (-[WKWindowVisibilityObserver startObserving:]): (-[WKWindowVisibilityObserver stopObserving]): (-[WKWindowVisibilityObserver enableObservingFontPanel]): Added. (-[WKWindowVisibilityObserver startObservingFontPanel]): (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]): (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]): (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]): (-[WKWindowVisibilityObserver _windowDidBecomeKey:]): (-[WKWindowVisibilityObserver _windowDidResignKey:]): (-[WKWindowVisibilityObserver _windowDidMiniaturize:]): (-[WKWindowVisibilityObserver _windowDidDeminiaturize:]): (-[WKWindowVisibilityObserver _windowDidMove:]): (-[WKWindowVisibilityObserver _windowDidResize:]): (-[WKWindowVisibilityObserver _windowWillBeginSheet:]): (-[WKWindowVisibilityObserver _windowDidChangeBackingProperties:]): (-[WKWindowVisibilityObserver _windowDidChangeScreen:]): (-[WKWindowVisibilityObserver _windowDidChangeLayerHosting:]): (-[WKWindowVisibilityObserver _windowDidChangeOcclusionState:]): (-[WKWindowVisibilityObserver _screenDidChangeColorSpace:]): (-[WKWindowVisibilityObserver observeValueForKeyPath:ofObject:change:context:]): (-[WKWindowVisibilityObserver _dictionaryLookupPopoverWillClose:]): (-[WKWindowVisibilityObserver _activeSpaceDidChange:]): (WebKit::WebViewImpl::~WebViewImpl): (WebKit::WebViewImpl::viewWillMoveToWindowImpl): (WebKit::WebViewImpl::didBecomeEditable): Canonical link: https://commits.webkit.org/277625@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes