implemented wxNativeFontInfo::operator=() when wxUSE_PANGO, this fixes crashes when wxFont::SetNativeFontInfo() is used
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -136,9 +136,21 @@ public:
|
|||||||
wxNativeFontInfo() { Init(); }
|
wxNativeFontInfo() { Init(); }
|
||||||
|
|
||||||
#if wxUSE_PANGO
|
#if wxUSE_PANGO
|
||||||
wxNativeFontInfo(const wxNativeFontInfo& info);
|
private:
|
||||||
~wxNativeFontInfo();
|
void Init(const wxNativeFontInfo& info);
|
||||||
#endif
|
void Free();
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxNativeFontInfo(const wxNativeFontInfo& info) { Init(info); }
|
||||||
|
~wxNativeFontInfo() { Free(); }
|
||||||
|
|
||||||
|
wxNativeFontInfo& operator=(const wxNativeFontInfo& info)
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
Init(info);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif // wxUSE_PANGO
|
||||||
|
|
||||||
// reset to the default state
|
// reset to the default state
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -57,7 +57,8 @@ void wxNativeFontInfo::Init()
|
|||||||
description = NULL;
|
description = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info)
|
void
|
||||||
|
wxNativeFontInfo::Init(const wxNativeFontInfo& info)
|
||||||
{
|
{
|
||||||
if (info.description)
|
if (info.description)
|
||||||
description = pango_font_description_copy(info.description);
|
description = pango_font_description_copy(info.description);
|
||||||
@@ -65,7 +66,7 @@ wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info)
|
|||||||
description = NULL;
|
description = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNativeFontInfo::~wxNativeFontInfo()
|
wxNativeFontInfo::Free()
|
||||||
{
|
{
|
||||||
if (description)
|
if (description)
|
||||||
pango_font_description_free(description);
|
pango_font_description_free(description);
|
||||||
|
Reference in New Issue
Block a user