Title: [263869] trunk/Source/WebKit
Revision
263869
Author
commit-qu...@webkit.org
Date
2020-07-02 15:43:59 -0700 (Thu, 02 Jul 2020)

Log Message

Crash in +[UIViewController _viewControllerForFullScreenPresentationFromView:] when WKContentView is deallocated
https://bugs.webkit.org/show_bug.cgi?id=213867

Patch by Austin Blackwood <ablackwo...@apple.com> on 2020-07-02
Reviewed by Darin Adler.

+[UIViewController _viewControllerForFullScreenPresentationFromView:]
asserts that the view parameter is non-nil. WKFileUploadPanel
passes its view (a weak pointer to the WKContentView), which may
have already been nil'd out when the content view tries to dismiss
the panel in its own dealloc.

* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel dismiss]):
Check for nil.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (263868 => 263869)


--- trunk/Source/WebKit/ChangeLog	2020-07-02 22:42:46 UTC (rev 263868)
+++ trunk/Source/WebKit/ChangeLog	2020-07-02 22:43:59 UTC (rev 263869)
@@ -1,3 +1,20 @@
+2020-07-02  Austin Blackwood  <ablackwo...@apple.com>
+
+        Crash in +[UIViewController _viewControllerForFullScreenPresentationFromView:] when WKContentView is deallocated
+        https://bugs.webkit.org/show_bug.cgi?id=213867
+
+        Reviewed by Darin Adler.
+
+        +[UIViewController _viewControllerForFullScreenPresentationFromView:]
+        asserts that the view parameter is non-nil. WKFileUploadPanel
+        passes its view (a weak pointer to the WKContentView), which may
+        have already been nil'd out when the content view tries to dismiss
+        the panel in its own dealloc.
+
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel dismiss]):
+        Check for nil.
+
 2020-07-02  Chris Dumez  <cdu...@apple.com>
 
         FloatingPointEnvironment::saveMainThreadEnvironment() is not called for macOS Catalyst apps on Apple Silicon

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (263868 => 263869)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2020-07-02 22:42:46 UTC (rev 263868)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2020-07-02 22:43:59 UTC (rev 263869)
@@ -283,13 +283,14 @@
 {
     // Dismiss any view controller that is being presented. This works for all types of view controllers, popovers, etc.
     // If there is any kind of view controller presented on this view, it will be removed.
+
+    if (auto view = _view.get())
+        [[UIViewController _viewControllerForFullScreenPresentationFromView:view.get()] dismissViewControllerAnimated:NO completion:nil];
     
-    [[UIViewController _viewControllerForFullScreenPresentationFromView:_view.getAutoreleased()] dismissViewControllerAnimated:NO completion:nil];
-    
     [_presentationPopover setDelegate:nil];
     _presentationPopover = nil;
     _presentationViewController = nil;
-    
+
     [self _cancel];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to