[Webkit-unassigned] [Bug 125868] Crash when trying to copy image

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 30 20:19:44 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=125868

--- Comment #5 from Jeremy Zerfas <WebKit at JeremyZerfas.com> ---
(In reply to comment #4)

> > Source/WebCore/ChangeLog:12
> > +        No new tests needed.
> 
> Why are not no new tests needed for this change?

I didn't think it was possible to get the memory statistics needed for testing but after doing a more thorough search I found the mallocStatistics() function which will be sufficient. I've created a new patch that now includes a test for this.

> > Source/WebCore/platform/mac/PasteboardMac.mm:258
> > +    NSData *imageData = (NSData*)(pasteboardImage.image->getTIFFRepresentation());
> 
> I think this is wrong. The clipboard has to manage deallocating its own
> data. The original data can be freed or even the whole application gets shut
> down but the clipboard should keep its data. In other words, I think a new
> memory buffer has to be allocated every time we want to write to the
> clipboard.

I'm pretty sure that assessment is wrong but I might have misled you because I was mistaken about the NSImage allocation causing much of the extra memory use. The difference in memory usage is primarily due to using getTIFFRepresentation() to get the TIFF data instead of using getNSImage() to allocate a NSImage (which is just a wrapper around the data returned from getTIFFRepresentation() anyway) and then calling TIFFRepresentation on the NSImage which requires more overhead. The clipboard doesn't need the NSImage, it only needs the TIFF data which is still being allocated. As a bit of a proof of this, pasting the animation from the clipboard into another app still works fine even after quitting the patched browser. Hope that clears things up.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150831/8167b4ea/attachment-0001.html>


More information about the webkit-unassigned mailing list