Title: [241359] branches/safari-608.1.5.1-branch/Source/WebKit
Revision
241359
Author
[email protected]
Date
2019-02-13 01:02:36 -0800 (Wed, 13 Feb 2019)

Log Message

Cherry-pick r240995. rdar://problem/47719379

    Reproducible crash under WKShareSheet presentWithParameters when cancelling a share
    https://bugs.webkit.org/show_bug.cgi?id=194301
    <rdar://problem/47719379>

    Reviewed by Beth Dakin.

    * UIProcess/Cocoa/WKShareSheet.mm:
    (-[WKShareSheet presentWithParameters:completionHandler:]):
    NSSharingServicePicker's delegate callbacks can be called synchronously.
    We release the WKShareSheet (which holds our reference to the NSSharingServicePicker)
    under sharingServicePicker:didChooseSharingService:. On older versions of macOS,
    there was nothing keeping the NSSharingServicePicker alive inside
    showRelativeToRect:ofView:preferredEdge:, thus the whole chain of references would
    fall and result in sending a message to a released NSSharingServicePicker.
    To resolve this, keep an extra reference to the WKShareSheet until
    presentation is complete.

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

Modified Paths

Diff

Modified: branches/safari-608.1.5.1-branch/Source/WebKit/ChangeLog (241358 => 241359)


--- branches/safari-608.1.5.1-branch/Source/WebKit/ChangeLog	2019-02-13 09:02:34 UTC (rev 241358)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/ChangeLog	2019-02-13 09:02:36 UTC (rev 241359)
@@ -1,5 +1,48 @@
 2019-02-13  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r240995. rdar://problem/47719379
+
+    Reproducible crash under WKShareSheet presentWithParameters when cancelling a share
+    https://bugs.webkit.org/show_bug.cgi?id=194301
+    <rdar://problem/47719379>
+    
+    Reviewed by Beth Dakin.
+    
+    * UIProcess/Cocoa/WKShareSheet.mm:
+    (-[WKShareSheet presentWithParameters:completionHandler:]):
+    NSSharingServicePicker's delegate callbacks can be called synchronously.
+    We release the WKShareSheet (which holds our reference to the NSSharingServicePicker)
+    under sharingServicePicker:didChooseSharingService:. On older versions of macOS,
+    there was nothing keeping the NSSharingServicePicker alive inside
+    showRelativeToRect:ofView:preferredEdge:, thus the whole chain of references would
+    fall and result in sending a message to a released NSSharingServicePicker.
+    To resolve this, keep an extra reference to the WKShareSheet until
+    presentation is complete.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-05  Tim Horton  <[email protected]>
+
+            Reproducible crash under WKShareSheet presentWithParameters when cancelling a share
+            https://bugs.webkit.org/show_bug.cgi?id=194301
+            <rdar://problem/47719379>
+
+            Reviewed by Beth Dakin.
+
+            * UIProcess/Cocoa/WKShareSheet.mm:
+            (-[WKShareSheet presentWithParameters:completionHandler:]):
+            NSSharingServicePicker's delegate callbacks can be called synchronously.
+            We release the WKShareSheet (which holds our reference to the NSSharingServicePicker)
+            under sharingServicePicker:didChooseSharingService:. On older versions of macOS,
+            there was nothing keeping the NSSharingServicePicker alive inside
+            showRelativeToRect:ofView:preferredEdge:, thus the whole chain of references would
+            fall and result in sending a message to a released NSSharingServicePicker.
+            To resolve this, keep an extra reference to the WKShareSheet until
+            presentation is complete.
+
+2019-02-13  Babak Shafiei  <[email protected]>
+
         Cherry-pick r240983. rdar://problem/47756320
 
     Unreviewed, rolling out r240742.

Modified: branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm (241358 => 241359)


--- branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm	2019-02-13 09:02:34 UTC (rev 241358)
+++ branches/safari-608.1.5.1-branch/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm	2019-02-13 09:02:36 UTC (rev 241359)
@@ -101,6 +101,9 @@
     _sharingServicePicker = adoptNS([[NSSharingServicePicker alloc] initWithItems:shareDataArray.get()]);
     _sharingServicePicker.get().delegate = self;
     
+    // WKShareSheet can be released under NSSharingServicePicker delegate callbacks.
+    RetainPtr<WKShareSheet> protector(self);
+    
     NSPoint location = [NSEvent mouseLocation];
     NSRect mouseLocationRect = NSMakeRect(location.x, location.y, 1.0, 1.0);
     NSRect mouseLocationInWindow = [webView.window convertRectFromScreen:mouseLocationRect];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to