fixed memory leak in wxNativeFontInfo when using Pango
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28146 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -135,6 +135,11 @@ public:
|
|||||||
// default ctor (default copy ctor is ok)
|
// default ctor (default copy ctor is ok)
|
||||||
wxNativeFontInfo() { Init(); }
|
wxNativeFontInfo() { Init(); }
|
||||||
|
|
||||||
|
#if wxUSE_PANGO
|
||||||
|
wxNativeFontInfo(const wxNativeFontInfo& info);
|
||||||
|
~wxNativeFontInfo();
|
||||||
|
#endif
|
||||||
|
|
||||||
// reset to the default state
|
// reset to the default state
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
@@ -204,7 +204,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|||||||
if ( style && style->font_desc )
|
if ( style && style->font_desc )
|
||||||
{
|
{
|
||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
info.description = style->font_desc;
|
info.description = pango_font_description_copy(style->font_desc);
|
||||||
attr.font = wxFont(info);
|
attr.font = wxFont(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -308,7 +308,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
if ( def && def->font_desc )
|
if ( def && def->font_desc )
|
||||||
{
|
{
|
||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
info.description = def->font_desc;
|
info.description =
|
||||||
|
pango_font_description_copy(def->font_desc);
|
||||||
gs_objects.m_fontSystem = wxFont(info);
|
gs_objects.m_fontSystem = wxFont(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -204,7 +204,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
|
|||||||
if ( style && style->font_desc )
|
if ( style && style->font_desc )
|
||||||
{
|
{
|
||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
info.description = style->font_desc;
|
info.description = pango_font_description_copy(style->font_desc);
|
||||||
attr.font = wxFont(info);
|
attr.font = wxFont(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -308,7 +308,8 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
if ( def && def->font_desc )
|
if ( def && def->font_desc )
|
||||||
{
|
{
|
||||||
wxNativeFontInfo info;
|
wxNativeFontInfo info;
|
||||||
info.description = def->font_desc;
|
info.description =
|
||||||
|
pango_font_description_copy(def->font_desc);
|
||||||
gs_objects.m_fontSystem = wxFont(info);
|
gs_objects.m_fontSystem = wxFont(info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -57,6 +57,20 @@ void wxNativeFontInfo::Init()
|
|||||||
description = NULL;
|
description = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info)
|
||||||
|
{
|
||||||
|
if (info.description)
|
||||||
|
description = pango_font_description_copy(info.description);
|
||||||
|
else
|
||||||
|
description = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxNativeFontInfo::~wxNativeFontInfo()
|
||||||
|
{
|
||||||
|
if (description)
|
||||||
|
pango_font_description_free(description);
|
||||||
|
}
|
||||||
|
|
||||||
int wxNativeFontInfo::GetPointSize() const
|
int wxNativeFontInfo::GetPointSize() const
|
||||||
{
|
{
|
||||||
return pango_font_description_get_size( description ) / PANGO_SCALE;
|
return pango_font_description_get_size( description ) / PANGO_SCALE;
|
||||||
|
Reference in New Issue
Block a user