Crash when loadViewIfRequired called while WKFullScreenViewController is being deallo...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2018 00:27:13 +0000 (00:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2018 00:27:13 +0000 (00:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187920
rdar://problem/41324023

Patch by Jeremy Jones <jeremyj@apple.com> on 2018-07-23
Reviewed by Eric Carlson.

Clear dangling weak-ref.
Prevent async playback state calls from instantiating the interface.
Release WKFullScreenViewController when it is no longer needed.

* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController dealloc]):
(-[WKFullScreenViewController setPlaying:]):
(-[WKFullScreenViewController setAnimating:]):
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController _completedExitFullScreen]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234124 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm
Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm

index 584f26a..f2880d6 100644 (file)
@@ -1,3 +1,22 @@
+2018-07-23  Jeremy Jones  <jeremyj@apple.com>
+
+        Crash when loadViewIfRequired called while WKFullScreenViewController is being deallocated.
+        https://bugs.webkit.org/show_bug.cgi?id=187920
+        rdar://problem/41324023
+
+        Reviewed by Eric Carlson.
+
+        Clear dangling weak-ref.
+        Prevent async playback state calls from instantiating the interface.
+        Release WKFullScreenViewController when it is no longer needed.
+
+        * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
+        (-[WKFullScreenViewController dealloc]):
+        (-[WKFullScreenViewController setPlaying:]):
+        (-[WKFullScreenViewController setAnimating:]):
+        * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
+        (-[WKFullScreenWindowController _completedExitFullScreen]):
+
 2018-07-23  Timothy Horton  <timothy_horton@apple.com>
 
         Try to fix the build.
index 94f0343..d88d63d 100644 (file)
@@ -199,6 +199,7 @@ private:
     [NSObject cancelPreviousPerformRequestsWithTarget:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
+    _playbackClient.setParent(nullptr);
     _playbackClient.setInterface(nullptr);
     _videoFullscreenClient.setParent(nullptr);
     _videoFullscreenClient.setInterface(nullptr);
@@ -287,6 +288,10 @@ private:
         return;
 
     _playing = isPlaying;
+
+    if (![self viewIfLoaded])
+        return;
+
     if (!_playing)
         [self showUI];
     else {
@@ -310,6 +315,10 @@ private:
     if (_animating == animating)
         return;
     _animating = animating;
+
+    if (![self viewIfLoaded])
+        return
+
     [self setNeedsStatusBarAppearanceUpdate];
 
     if (_animating)
index 8e87aff..1665c3e 100644 (file)
@@ -752,6 +752,7 @@ static const NSTimeInterval kAnimationDuration = 0.2;
         _repaintCallback->performCallback();
 
     [_fullscreenViewController setPrefersStatusBarHidden:YES];
+    _fullscreenViewController = nil;
 }
 
 - (void)close