QCoreTextFontDatabase: close memory leak in themeFont

if the CTFontDescriptorRef is already contained in m_systemFontDescriptors
we leak a reference, unless we explicitly release it.

Change-Id: I5b263aa52b4433e7e28cc01164098892cc9cd2ae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Tim Blechmann 2014-12-16 13:19:40 +01:00 committed by Tor Arne Vestbø
parent b0088967c3
commit 099075427b

View File

@ -828,7 +828,11 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
CTFontDescriptorRef fontDesc = fontDescriptorFromTheme(f);
FontDescription fd;
getFontDescription(fontDesc, &fd);
m_systemFontDescriptors.insert(fontDesc);
if (!m_systemFontDescriptors.contains(fontDesc))
m_systemFontDescriptors.insert(fontDesc);
else
CFRelease(fontDesc);
QFont *font = new QFont(fd.familyName, fd.pixelSize, fd.weight, fd.style == QFont::StyleItalic);
return font;