[webkit-reviews] review granted: [Bug 208783] [iOS] Mapping to UTI from tag and tag class should be performed in the UI process : [Attachment 392992] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 8 15:54:58 PDT 2020


Brent Fulgham <bfulgham at webkit.org> has granted Per Arne Vollan
<pvollan at apple.com>'s request for review:
Bug 208783: [iOS] Mapping to UTI from tag and tag class should be performed in
the UI process
https://bugs.webkit.org/show_bug.cgi?id=208783

Attachment 392992: Patch

https://bugs.webkit.org/attachment.cgi?id=392992&action=review




--- Comment #17 from Brent Fulgham <bfulgham at webkit.org> ---
Comment on attachment 392992
  --> https://bugs.webkit.org/attachment.cgi?id=392992
Patch

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

Please fix the memory leaks (or explain how I am mistaken!). But r=me with that
change.

> Source/WebCore/platform/cocoa/UTTypeRecordSwizzler.mm:89
> +	       WebUTTypeRecord *record = [WebUTTypeRecord alloc];

Should we be using a smart pointer of some kind to avoid leaks/overreleases?

> Source/WebCore/platform/cocoa/UTTypeRecordSwizzler.mm:107
> +	       r.uti =
UTTypeCreatePreferredIdentifierForTag(r.tagClass.createCFString().get(),
r.tag.createCFString().get(), r.identifier.isNull() ? nullptr :
r.identifier.createCFString().get());

I think UTTypeCreatePreferredIdentifierForTag returns a CFStringRef with a +1
count. I think you need something like:

r.uti = adoptCF(UTTypeCreatePreferredIdentifierForTag ....).get();

Or maybe use your new UTIFromTag helper?

> Source/WebCore/platform/cocoa/UTTypeRecordSwizzler.mm:110
> +	       i.uti =
UTTypeCreatePreferredIdentifierForTag(i.tagClass.createCFString().get(),
i.tag.createCFString().get(), i.identifier.isNull() ? nullptr :
i.identifier.createCFString().get());

Ditto.


More information about the webkit-reviews mailing list