Skip to content

Commit a3569b0

Browse files
committed
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. Canonical link: https://commits.webkit.org/240192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 1466b6b commit a3569b0

2 files changed

Lines changed: 37 additions & 12 deletions

File tree

Source/WebKit/ChangeLog

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2021-08-02 Jean-Yves Avenard <jya@apple.com>
2+
3+
Crash in -[WKFullScreenWindowController windowDidExitFullScreen:]
4+
https://bugs.webkit.org/show_bug.cgi?id=228694
5+
rdar://79569881
6+
7+
Reviewed by Jer Noble.
8+
9+
It appears that [WKFullScreenWindowController finishedEnterFullScreenAnimation] can
10+
cause the retain count to be decreased (this is the only explanation that makes any
11+
sense considering the crash and when the regression started following bug 227243).
12+
No test, can't reproduce.
13+
14+
* UIProcess/mac/WKFullScreenWindowController.mm:
15+
(-[WKFullScreenWindowController setVideoFullscreenManagerClient:]): Add utility method
16+
to remove duplicated code.
17+
(-[WKFullScreenWindowController didExitPictureInPicture]):
18+
(-[WKFullScreenWindowController windowDidEnterFullScreen:]):
19+
(-[WKFullScreenWindowController windowDidFailToExitFullScreen:]):
20+
(-[WKFullScreenWindowController windowDidExitFullScreen:]):
21+
(-[WKFullScreenWindowController _manager]): fly-by make style consistent with other
22+
similar methods.
23+
124
2021-08-02 Alex Christensen <achristensen@webkit.org>
225

326
Add log when experimental network loader is used

Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,19 @@ - (void)didEnterPictureInPicture
645645
[self requestExitFullScreen];
646646
}
647647

648-
- (void)didExitPictureInPicture
648+
- (void)setVideoFullscreenManagerClient:(WebKit::VideoFullscreenManagerProxyClient *)client
649649
{
650650
if (auto* videoFullscreenManager = self._videoFullscreenManager) {
651651
ASSERT(videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient);
652-
videoFullscreenManager->setClient(nullptr);
652+
videoFullscreenManager->setClient(client);
653653
}
654654
}
655655

656+
- (void)didExitPictureInPicture
657+
{
658+
[self setVideoFullscreenManagerClient:nullptr];
659+
}
660+
656661
#pragma mark -
657662
#pragma mark Custom NSWindow Full Screen Animation
658663

@@ -683,27 +688,23 @@ - (void)windowDidFailToEnterFullScreen:(NSWindow *)window
683688

684689
- (void)windowDidEnterFullScreen:(NSNotification *)notification
685690
{
691+
RetainPtr<WKFullScreenWindowController> retain = self;
686692
[self finishedEnterFullScreenAnimation:YES];
687-
688-
if (auto* videoFullscreenManager = self._videoFullscreenManager) {
689-
ASSERT(videoFullscreenManager->client() == nullptr);
690-
videoFullscreenManager->setClient(&_videoFullscreenManagerProxyClient);
691-
}
693+
[self setVideoFullscreenManagerClient:&_videoFullscreenManagerProxyClient];
692694
}
693695

694696
- (void)windowDidFailToExitFullScreen:(NSWindow *)window
695697
{
698+
RetainPtr<WKFullScreenWindowController> retain = self;
696699
[self finishedExitFullScreenAnimation:NO];
700+
[self setVideoFullscreenManagerClient:nullptr];
697701
}
698702

699703
- (void)windowDidExitFullScreen:(NSNotification *)notification
700704
{
705+
RetainPtr<WKFullScreenWindowController> retain = self;
701706
[self finishedExitFullScreenAnimation:YES];
702-
703-
if (auto* videoFullscreenManager = self._videoFullscreenManager) {
704-
ASSERT(videoFullscreenManager->client() == &_videoFullscreenManagerProxyClient);
705-
videoFullscreenManager->setClient(nullptr);
706-
}
707+
[self setVideoFullscreenManagerClient:nullptr];
707708
}
708709

709710
- (NSWindow *)destinationWindowToExitFullScreenForWindow:(NSWindow *)window
@@ -718,6 +719,7 @@ - (NSWindow *)destinationWindowToExitFullScreenForWindow:(NSWindow *)window
718719
{
719720
if (!_page)
720721
return nullptr;
722+
721723
return _page->fullScreenManager();
722724
}
723725

0 commit comments

Comments
 (0)