[Mac] -[WebPDFView _menuItemsFromPDFKitForEvent:] leaks NSMenuItems
Created attachment 148263 [details] Patch
Comment on attachment 148263 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148263&action=review > Source/WebKit/mac/WebView/WebPDFView.mm:1153 > + RetainPtr<NSMenuItem> itemCopy(AdoptNS, [item copy]); > + [copiedItems addObject:itemCopy.get()]; The RetainPtr seems overkill. You can just immediately release itemCopy after adding it to the copiedItems array, and rely on the items presence in the array to keep it alive for as long as we are dealing with it.
Comment on attachment 148263 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148263&action=review >> Source/WebKit/mac/WebView/WebPDFView.mm:1153 >> + [copiedItems addObject:itemCopy.get()]; > > The RetainPtr seems overkill. You can just immediately release itemCopy after adding it to the copiedItems array, and rely on the items presence in the array to keep it alive for as long as we are dealing with it. I like Mark’s suggestion, but this change is also OK as is.
Committed r120726: <http://trac.webkit.org/changeset/120726>