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:
parent
b0088967c3
commit
099075427b
@ -828,7 +828,11 @@ QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const
|
|||||||
CTFontDescriptorRef fontDesc = fontDescriptorFromTheme(f);
|
CTFontDescriptorRef fontDesc = fontDescriptorFromTheme(f);
|
||||||
FontDescription fd;
|
FontDescription fd;
|
||||||
getFontDescription(fontDesc, &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);
|
QFont *font = new QFont(fd.familyName, fd.pixelSize, fd.weight, fd.style == QFont::StyleItalic);
|
||||||
return font;
|
return font;
|
||||||
|
Loading…
Reference in New Issue
Block a user