RESOLVED FIXED 89434
[Mac] -[WebPDFView _menuItemsFromPDFKitForEvent:] leaks NSMenuItems
https://bugs.webkit.org/show_bug.cgi?id=89434
Summary [Mac] -[WebPDFView _menuItemsFromPDFKitForEvent:] leaks NSMenuItems
Andy Estes
Reported 2012-06-18 23:40:23 PDT
[Mac] -[WebPDFView _menuItemsFromPDFKitForEvent:] leaks NSMenuItems
Attachments
Patch (3.13 KB, patch)
2012-06-18 23:42 PDT, Andy Estes
darin: review+
aestes: commit-queue-
Andy Estes
Comment 1 2012-06-18 23:42:30 PDT
Mark Rowe (bdash)
Comment 2 2012-06-19 00:05:09 PDT
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.
Darin Adler
Comment 3 2012-06-19 08:30:22 PDT
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.
Andy Estes
Comment 4 2012-06-19 10:09:40 PDT
Note You need to log in before you can comment on or make changes to this bug.