Title: [247320] branches/safari-608.1.34.0-branch/Source/WebKit
Revision
247320
Author
[email protected]
Date
2019-07-10 13:02:30 -0700 (Wed, 10 Jul 2019)

Log Message

Cherry-pick r247185. rdar://problem/52554137

    [iOS] Context Menu - Add to Reading List does nothing
    https://bugs.webkit.org/show_bug.cgi?id=199504
    <rdar://problem/52554137>

    Reviewed by Anders Carlsson.

    We were holding weak references to the _WKElementAction in
    the handler provided to UIAction. By the time the handler was
    called, the object had been deallocated.

    * UIProcess/API/Cocoa/_WKElementAction.mm:
    (-[_WKElementAction uiActionForElementInfo:]): Use strong references in handler.

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

Modified Paths

Diff

Modified: branches/safari-608.1.34.0-branch/Source/WebKit/ChangeLog (247319 => 247320)


--- branches/safari-608.1.34.0-branch/Source/WebKit/ChangeLog	2019-07-10 20:01:55 UTC (rev 247319)
+++ branches/safari-608.1.34.0-branch/Source/WebKit/ChangeLog	2019-07-10 20:02:30 UTC (rev 247320)
@@ -1,3 +1,37 @@
+2019-07-10  Alan Coon  <[email protected]>
+
+        Cherry-pick r247185. rdar://problem/52554137
+
+    [iOS] Context Menu - Add to Reading List does nothing
+    https://bugs.webkit.org/show_bug.cgi?id=199504
+    <rdar://problem/52554137>
+    
+    Reviewed by Anders Carlsson.
+    
+    We were holding weak references to the _WKElementAction in
+    the handler provided to UIAction. By the time the handler was
+    called, the object had been deallocated.
+    
+    * UIProcess/API/Cocoa/_WKElementAction.mm:
+    (-[_WKElementAction uiActionForElementInfo:]): Use strong references in handler.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-05  Dean Jackson  <[email protected]>
+
+            [iOS] Context Menu - Add to Reading List does nothing
+            https://bugs.webkit.org/show_bug.cgi?id=199504
+            <rdar://problem/52554137>
+
+            Reviewed by Anders Carlsson.
+
+            We were holding weak references to the _WKElementAction in
+            the handler provided to UIAction. By the time the handler was
+            called, the object had been deallocated.
+
+            * UIProcess/API/Cocoa/_WKElementAction.mm:
+            (-[_WKElementAction uiActionForElementInfo:]): Use strong references in handler.
+
 2019-07-09  Alan Coon  <[email protected]>
 
         Cherry-pick r247180. rdar://problem/51597945

Modified: branches/safari-608.1.34.0-branch/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm (247319 => 247320)


--- branches/safari-608.1.34.0-branch/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm	2019-07-10 20:01:55 UTC (rev 247319)
+++ branches/safari-608.1.34.0-branch/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm	2019-07-10 20:02:30 UTC (rev 247320)
@@ -29,6 +29,7 @@
 #if PLATFORM(IOS_FAMILY)
 
 #import "GestureTypes.h"
+#import "Logging.h"
 #import "WKActionSheetAssistant.h"
 #import "WKContentViewInteraction.h"
 #import "_WKActivatedElementInfoInternal.h"
@@ -284,14 +285,10 @@
     UIImage *image = [_WKElementAction imageForElementActionType:self.type];
     UIActionIdentifier identifier = elementActionTypeToUIActionIdentifier(self.type);
 
-    return [UIAction actionWithTitle:self.title image:image identifier:identifier handler:[weakSelf = WeakObjCPtr<_WKElementAction>(self), weakElementInfo = WeakObjCPtr<_WKActivatedElementInfo>(elementInfo)] (UIAction *) {
-        auto strongSelf = weakSelf.get();
-        if (!strongSelf)
-            return;
-        auto strongElementInfo = weakElementInfo.get();
-        if (!strongElementInfo)
-            return;
-        [strongSelf runActionWithElementInfo:strongElementInfo.get()];
+    return [UIAction actionWithTitle:self.title image:image identifier:identifier handler:[retainedSelf = retainPtr(self), retainedInfo = retainPtr(elementInfo)] (UIAction *) {
+        auto elementAction = retainedSelf.get();
+        RELEASE_LOG(ContextMenu, "Executing action for type: %s", elementActionTypeToUIActionIdentifier([elementAction type]).UTF8String);
+        [elementAction runActionWithElementInfo:retainedInfo.get()];
     }];
 }
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to