Title: [235431] trunk/Tools
Revision
235431
Author
wenson_hs...@apple.com
Date
2018-08-28 11:04:54 -0700 (Tue, 28 Aug 2018)

Log Message

[iOS] WKAttachmentTests.DropFolderAsAttachmentAndMoveByDragging encounters an exception on iOS simulator
https://bugs.webkit.org/show_bug.cgi?id=189049

Reviewed by Tim Horton.

Wrap an NSURL in a RetainPtr to prevent it from being freed prematurely. It seems this broke when I changed the
load handler from an Objective-C block that captured `folderURL` to a C++ lambda that didn't retain `folderURL`.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(simulateFolderDragWithURL):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (235430 => 235431)


--- trunk/Tools/ChangeLog	2018-08-28 18:00:45 UTC (rev 235430)
+++ trunk/Tools/ChangeLog	2018-08-28 18:04:54 UTC (rev 235431)
@@ -1,3 +1,16 @@
+2018-08-28  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iOS] WKAttachmentTests.DropFolderAsAttachmentAndMoveByDragging encounters an exception on iOS simulator
+        https://bugs.webkit.org/show_bug.cgi?id=189049
+
+        Reviewed by Tim Horton.
+
+        Wrap an NSURL in a RetainPtr to prevent it from being freed prematurely. It seems this broke when I changed the
+        load handler from an Objective-C block that captured `folderURL` to a C++ lambda that didn't retain `folderURL`.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+        (simulateFolderDragWithURL):
+
 2018-08-27  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (235430 => 235431)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2018-08-28 18:00:45 UTC (rev 235430)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2018-08-28 18:04:54 UTC (rev 235431)
@@ -416,8 +416,8 @@
     auto folderProvider = adoptNS([[NSItemProvider alloc] init]);
     [folderProvider setSuggestedName:folderURL.lastPathComponent];
     [folderProvider setPreferredPresentationStyle:UIPreferredPresentationStyleAttachment];
-    [folderProvider registerFileRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeFolder fileOptions:0 visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[&] (void(^completion)(NSURL *, BOOL, NSError *)) -> NSProgress * {
-        completion(folderURL, NO, nil);
+    [folderProvider registerFileRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeFolder fileOptions:0 visibility:NSItemProviderRepresentationVisibilityAll loadHandler:[protectedFolderURL = retainPtr(folderURL)] (void(^completion)(NSURL *, BOOL, NSError *)) -> NSProgress * {
+        completion(protectedFolderURL.get(), NO, nil);
         return nil;
     }];
     simulator.externalItemProviders = @[ folderProvider.get() ];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to