Bug 211197

Summary: REGRESSION (r246395): Leak of ARQuickLookPreviewItem and ARQuickLookWebKitItem in -[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebKit2Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, graouts, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 198812    
Bug Blocks:    
Attachments:
Description Flags
Patch v1
none
Patch v2
none
Patch for landing none

Description David Kilzer (:ddkilzer) 2020-04-29 12:20:08 PDT
Leak of ARQuickLookPreviewItem and ARQuickLookWebKitItem in -[_WKPreviewControllerDataSource previewController:previewItemAtIndex:].

Regressed in r246395 for Bug 198812.
Comment 1 Radar WebKit Bug Importer 2020-04-29 12:20:23 PDT
<rdar://problem/62612483>
Comment 2 David Kilzer (:ddkilzer) 2020-04-29 12:24:28 PDT
Created attachment 397985 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2020-04-29 12:36:53 PDT
Created attachment 397988 [details]
Patch v2
Comment 4 David Kilzer (:ddkilzer) 2020-04-29 12:37:22 PDT
(In reply to David Kilzer (:ddkilzer) from comment #3)
> Created attachment 397988 [details]
> Patch v2

Fixed build error:

-    previewItem.canonicalWebPageURL = _originatingPageURL;
+    previewItem.get().canonicalWebPageURL = _originatingPageURL;
Comment 5 Darin Adler 2020-04-29 13:49:05 PDT
Comment on attachment 397988 [details]
Patch v2

View in context: https://bugs.webkit.org/attachment.cgi?id=397988&action=review

> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:113
> +    previewItem.get().canonicalWebPageURL = _originatingPageURL;

Some WebKit contributors prefer this style to sidestep the get():

    [previewItem setCanonicalWebPageURL:_originatingPageURL];
Comment 6 David Kilzer (:ddkilzer) 2020-04-29 13:50:33 PDT
Comment on attachment 397988 [details]
Patch v2

View in context: https://bugs.webkit.org/attachment.cgi?id=397988&action=review

>> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:113
>> +    previewItem.get().canonicalWebPageURL = _originatingPageURL;
> 
> Some WebKit contributors prefer this style to sidestep the get():
> 
>     [previewItem setCanonicalWebPageURL:_originatingPageURL];

Wasn't sure if new-style Objective-C setters (with .get()) were preferred over old-style setter syntax (but no .get()).
Comment 7 Darin Adler 2020-04-29 14:06:49 PDT
Comment on attachment 397988 [details]
Patch v2

View in context: https://bugs.webkit.org/attachment.cgi?id=397988&action=review

>>> Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:113
>>> +    previewItem.get().canonicalWebPageURL = _originatingPageURL;
>> 
>> Some WebKit contributors prefer this style to sidestep the get():
>> 
>>     [previewItem setCanonicalWebPageURL:_originatingPageURL];
> 
> Wasn't sure if new-style Objective-C setters (with .get()) were preferred over old-style setter syntax (but no .get()).

Tim Horton was the one who explained the lack of Objective-C setters in another patch, by citing this.
Comment 8 David Kilzer (:ddkilzer) 2020-04-29 15:10:05 PDT
Created attachment 397999 [details]
Patch for landing
Comment 9 David Kilzer (:ddkilzer) 2020-04-29 16:04:41 PDT
Comment on attachment 397999 [details]
Patch for landing

Marking cq+ because "Patch v2" has passed all tests except one ios-wk2 test (fast/text/text-indent-inside-float.html) which this patch is not likely to have affected.
Comment 10 EWS 2020-04-29 16:08:06 PDT
Committed r260922: <https://trac.webkit.org/changeset/260922>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397999 [details].