Bug 201893

Summary: REGRESSION (r247566): Leak of UICTFontDescriptor in WebCore::FontDatabase::InstalledFont::InstalledFont()
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: TextAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, joepeck, mmaxfield, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=199769
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2019-09-17 19:46:39 PDT
Leak of UICTFontDescriptor in WebCore::FontDatabase::InstalledFont::InstalledFont():

    struct InstalledFont {
        InstalledFont() = default;

        InstalledFont(CTFontDescriptorRef fontDescriptor, AllowUserInstalledFonts allowUserInstalledFonts)
            : fontDescriptor(fontDescriptor)
            , capabilities(capabilitiesForFontDescriptor(fontDescriptor))
        {
#if HAVE(CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION)
            UNUSED_PARAM(allowUserInstalledFonts);
#else
            if (allowUserInstalledFonts != AllowUserInstalledFonts::No)
                return;
            auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
            addAttributesForInstalledFonts(attributes.get(), allowUserInstalledFonts);
            this->fontDescriptor = CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, attributes.get());  // LEAK of CTFontDescriptorRef.  Missing adoptCF().
#endif
        }

        RetainPtr<CTFontDescriptorRef> fontDescriptor;
        FontSelectionCapabilities capabilities;
    };

Regressed in:

Bug 199769: Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
<https://bugs.webkit.org/show_bug.cgi?id=199769>
<https://trac.webkit.org/changeset/247566/webkit>
Comment 1 David Kilzer (:ddkilzer) 2019-09-17 19:46:52 PDT
<rdar://problem/55464115>
Comment 2 David Kilzer (:ddkilzer) 2019-09-17 19:52:13 PDT
Created attachment 379014 [details]
Patch v1
Comment 3 Brent Fulgham 2019-09-17 20:26:40 PDT
Comment on attachment 379014 [details]
Patch v1

r=me
Comment 4 WebKit Commit Bot 2019-09-18 04:30:23 PDT
Comment on attachment 379014 [details]
Patch v1

Clearing flags on attachment: 379014

Committed r250031: <https://trac.webkit.org/changeset/250031>
Comment 5 WebKit Commit Bot 2019-09-18 04:30:24 PDT
All reviewed patches have been landed.  Closing bug.