Fixing Memory Leaking CTFontDescriptor Bug
see https://trac.wxwidgets.org/ticket/19012
This commit is contained in:
@@ -779,7 +779,8 @@ void wxNativeFontInfo::InitFromFont(CTFontRef font)
|
|||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
InitFromFontDescriptor(CTFontCopyFontDescriptor(font) );
|
wxCFRef<CTFontDescriptorRef> desc(CTFontCopyFontDescriptor(font));
|
||||||
|
InitFromFontDescriptor( desc );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNativeFontInfo::InitFromFontDescriptor(CTFontDescriptorRef desc)
|
void wxNativeFontInfo::InitFromFontDescriptor(CTFontDescriptorRef desc)
|
||||||
@@ -787,6 +788,7 @@ void wxNativeFontInfo::InitFromFontDescriptor(CTFontDescriptorRef desc)
|
|||||||
Init();
|
Init();
|
||||||
|
|
||||||
m_descriptor.reset(wxCFRetain(desc));
|
m_descriptor.reset(wxCFRetain(desc));
|
||||||
|
int count = CFGetRetainCount(desc);
|
||||||
|
|
||||||
m_ctWeight = GetCTWeight(desc);
|
m_ctWeight = GetCTWeight(desc);
|
||||||
m_ctWidth = GetCTwidth(desc);
|
m_ctWidth = GetCTwidth(desc);
|
||||||
@@ -1065,6 +1067,7 @@ bool wxNativeFontInfo::FromString(const wxString& s)
|
|||||||
if (descriptor != NULL)
|
if (descriptor != NULL)
|
||||||
{
|
{
|
||||||
InitFromFontDescriptor(descriptor);
|
InitFromFontDescriptor(descriptor);
|
||||||
|
CFRelease(descriptor);
|
||||||
m_underlined = underlined;
|
m_underlined = underlined;
|
||||||
m_strikethrough = strikethrough;
|
m_strikethrough = strikethrough;
|
||||||
m_encoding = encoding;
|
m_encoding = encoding;
|
||||||
|
Reference in New Issue
Block a user