Title: [280568] trunk/Source/WebKit
Revision
280568
Author
[email protected]
Date
2021-08-02 16:19:18 -0700 (Mon, 02 Aug 2021)

Log Message

Crash in -[WKFullScreenWindowController windowDidExitFullScreen:]
https://bugs.webkit.org/show_bug.cgi?id=228694
rdar://79569881

Reviewed by Jer Noble.

It appears that [WKFullScreenWindowController finishedEnterFullScreenAnimation] can
cause the retain count to be decreased (this is the only explanation that makes any
sense considering the crash and when the regression started following bug 227243).
No test, can't reproduce.

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController setVideoFullscreenManagerClient:]): Add utility method
to remove duplicated code.
(-[WKFullScreenWindowController didExitPictureInPicture]):
(-[WKFullScreenWindowController windowDidEnterFullScreen:]):
(-[WKFullScreenWindowController windowDidFailToExitFullScreen:]):
(-[WKFullScreenWindowController windowDidExitFullScreen:]):
(-[WKFullScreenWindowController _manager]): fly-by make style consistent with other
similar methods.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (280567 => 280568)


--- trunk/Source/WebKit/ChangeLog	2021-08-02 23:01:09 UTC (rev 280567)
+++ trunk/Source/WebKit/ChangeLog	2021-08-02 23:19:18 UTC (rev 280568)
@@ -1,3 +1,26 @@
+2021-08-02  Jean-Yves Avenard  <[email protected]>
+
+        Crash in -[WKFullScreenWindowController windowDidExitFullScreen:]
+        https://bugs.webkit.org/show_bug.cgi?id=228694
+        rdar://79569881
+
+        Reviewed by Jer Noble.
+
+        It appears that [WKFullScreenWindowController finishedEnterFullScreenAnimation] can
+        cause the retain count to be decreased (this is the only explanation that makes any
+        sense considering the crash and when the regression started following bug 227243).
+        No test, can't reproduce.
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController setVideoFullscreenManagerClient:]): Add utility method
+        to remove duplicated code.
+        (-[WKFullScreenWindowController didExitPictureInPicture]):
+        (-[WKFullScreenWindowController windowDidEnterFullScreen:]):
+        (-[WKFullScreenWindowController windowDidFailToExitFullScreen:]):
+        (-[WKFullScreenWindowController windowDidExitFullScreen:]):
+        (-[WKFullScreenWindowController _manager]): fly-by make style consistent with other
+        similar methods.
+
 2021-08-02  Alex Christensen  <[email protected]>
 
         Add log when experimental network loader is used

Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm (280567 => 280568)


--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm	2021-08-02 23:01:09 UTC (rev 280567)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm	2021-08-02 23:19:18 UTC (rev 280568)
@@ -645,14 +645,19 @@
         [self requestExitFullScreen];
 }
 
-- (void)didExitPictureInPicture
+- (void)setVideoFullscreenManagerClient:(WebKit::VideoFullscreenManagerProxyClient *)client
 {
     if (auto* videoFullscreenManager = self._videoFullscreenManager) {
         ASSERT(videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient);
-        videoFullscreenManager->setClient(nullptr);
+        videoFullscreenManager->setClient(client);
     }
 }
 
+- (void)didExitPictureInPicture
+{
+    [self setVideoFullscreenManagerClient:nullptr];
+}
+
 #pragma mark -
 #pragma mark Custom NSWindow Full Screen Animation
 
@@ -683,27 +688,23 @@
 
 - (void)windowDidEnterFullScreen:(NSNotification *)notification
 {
+    RetainPtr<WKFullScreenWindowController> retain = self;
     [self finishedEnterFullScreenAnimation:YES];
-
-    if (auto* videoFullscreenManager = self._videoFullscreenManager) {
-        ASSERT(videoFullscreenManager->client() == nullptr);
-        videoFullscreenManager->setClient(&_videoFullscreenManagerProxyClient);
-    }
+    [self setVideoFullscreenManagerClient:&_videoFullscreenManagerProxyClient];
 }
 
 - (void)windowDidFailToExitFullScreen:(NSWindow *)window
 {
+    RetainPtr<WKFullScreenWindowController> retain = self;
     [self finishedExitFullScreenAnimation:NO];
+    [self setVideoFullscreenManagerClient:nullptr];
 }
 
 - (void)windowDidExitFullScreen:(NSNotification *)notification
 {
+    RetainPtr<WKFullScreenWindowController> retain = self;
     [self finishedExitFullScreenAnimation:YES];
-
-    if (auto* videoFullscreenManager = self._videoFullscreenManager) {
-        ASSERT(videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient);
-        videoFullscreenManager->setClient(nullptr);
-    }
+    [self setVideoFullscreenManagerClient:nullptr];
 }
 
 - (NSWindow *)destinationWindowToExitFullScreenForWindow:(NSWindow *)window
@@ -718,6 +719,7 @@
 {
     if (!_page)
         return nullptr;
+
     return _page->fullScreenManager();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to