Summary: | [Mac] No AutoreleasePool leaks when dragging image out of WebView | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> | ||||||
Component: | WebCore Misc. | Assignee: | Joseph Pecoraro <joepeck> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | joepeck, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Joseph Pecoraro
2013-08-14 11:56:59 PDT
Created attachment 208751 [details]
[PATCH] Proposed Fix
* STEPS TO REPRODUCE 1. Open <http://bogojoker.com> in Safari 2. Drag an image to your desktop => leaks * LEAK (allocation backtrace) Leak: 0x7f8617e96820 size=64 zone: DefaultMallocZone_0x106134000 __NSCFString ObjC CoreFoundation "/Users/pecoraro/Desktop/bogojoker.png" Call stack: [thread 0x10bad7000]: | thread_start | _pthread_start | WebCore::setMetaData(void*) | WTF::StringImpl::operator NSString*() | WTF::StringImpl::createCFString() | CFStringCreateWithBytes | __CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance | malloc_zone_malloc Comment on attachment 208751 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=208751&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:77 > static void* setMetaData(void* context) Mitz has a good suggestion. Instead of spawning a pthread for setMetaData (old code) we can just dispatch a block to do this. I'll look into that. Created attachment 208768 [details]
[PATCH] Proposed fix - convert pthread to dispatch block
Verified this by dragging and dropping images out of Safari to the Desktop and checking the "Get Info" finder window for "Where from" information.
Comment on attachment 208768 [details] [PATCH] Proposed fix - convert pthread to dispatch block View in context: https://bugs.webkit.org/attachment.cgi?id=208768&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:81 > + wkSetMetadataURL(URLStringCopy, referrerCopy, (NSString *)String::fromUTF8(fileSystemRepresentation(pathCopy).data())); You should just use -[NSString fileSystemRepresentation]. Committed <http://trac.webkit.org/changeset/154086>. |