<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - UIViewController with WKWebView presented modally causes the presented UIViewController to be dismissed."
   href="https://bugs.webkit.org/show_bug.cgi?id=165225#c38">Comment # 38</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - UIViewController with WKWebView presented modally causes the presented UIViewController to be dismissed."
   href="https://bugs.webkit.org/show_bug.cgi?id=165225">bug 165225</a>
              from <span class="vcard"><a class="email" href="mailto:bwright2&#64;apple.com" title="Brad Wright &lt;bwright2&#64;apple.com&gt;"> <span class="fn">Brad Wright</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=303134&amp;action=diff" name="attach_303134" title="Patch">attachment 303134</a> <a href="attachment.cgi?id=303134&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=303134&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=303134&amp;action=review</a>

<span class="quote">&gt;&gt; Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm:392
&gt;&gt; +    UIViewController *presentedViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:_view];
&gt; 
&gt; So if I understand correctly, [UIViewController _viewControllerForFullScreenPresentationFromView:_view] will fetch the _presentationPopover, if it exists, as well? If that is really the case, then this is OK, but we should at least tear down _presentationPopover properly (i.e. nil out _presentationPopover and set its delegate to nil).</span >

We don't actually need to call [_presentationPopover dismissPopoverAnimated:animated]; because this will take care of it:
[[UIViewController _viewControllerForFullScreenPresentationFromView:_view] dismissViewControllerAnimated:NO completion:nil];
I'm going to add this:
// Clean up any pointers
    [_presentationPopover setDelegate:nil];
    _presentationPopover = nil;
    _presentationViewController = nil;</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>