Bug 174143 - Crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationFromView:]
Summary: Crash in UIKit: +[UIViewController _viewControllerForFullScreenPresentationF...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ada Chan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-04 17:12 PDT by Ada Chan
Modified: 2017-07-05 10:44 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.43 KB, patch)
2017-07-04 17:39 PDT, Ada Chan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ada Chan 2017-07-04 17:12:27 PDT
<rdar://problem/28384582>

The crash happens in WKActionSheet.mm:

- (void)willRotate
{
    .....
    UIView *view = [_sheetDelegate hostViewForSheet];
    UIViewController *presentingViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:view];
    ...
}

We cannot guarantee that the action sheet belongs in a window, and view could be nil.  Passing nil to -[UIViewController _viewControllerForFullScreenPresentationFromView:] causes an exception to be thrown.
Comment 1 Ada Chan 2017-07-04 17:39:55 PDT
Created attachment 314588 [details]
Patch
Comment 2 Wenson Hsieh 2017-07-04 19:49:52 PDT
Comment on attachment 314588 [details]
Patch

r=me, this check and the explanation seem reasonable, though I think we still need a wk2r+. I don't know any simple way to test this, but we could make a TestWebKitAPI test case that simulates this situation by broadcasting UIWindowWillRotateNotification after presenting a popover in a WKWebView that's been removed from its UIWindow.
Comment 3 Beth Dakin 2017-07-05 10:16:39 PDT
Comment on attachment 314588 [details]
Patch

wk2r=me!
Comment 4 WebKit Commit Bot 2017-07-05 10:44:03 PDT
Comment on attachment 314588 [details]
Patch

Clearing flags on attachment: 314588

Committed r219136: <http://trac.webkit.org/changeset/219136>
Comment 5 WebKit Commit Bot 2017-07-05 10:44:05 PDT
All reviewed patches have been landed.  Closing bug.