diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h index e2243613dc..56099b4758 100644 --- a/include/wx/fontutil.h +++ b/include/wx/fontutil.h @@ -136,9 +136,21 @@ public: wxNativeFontInfo() { Init(); } #if wxUSE_PANGO - wxNativeFontInfo(const wxNativeFontInfo& info); - ~wxNativeFontInfo(); -#endif +private: + void Init(const wxNativeFontInfo& info); + 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 void Init(); diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index 79f36b31dd..ddbf06d0cf 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -57,7 +57,8 @@ void wxNativeFontInfo::Init() description = NULL; } -wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info) +void +wxNativeFontInfo::Init(const wxNativeFontInfo& info) { if (info.description) description = pango_font_description_copy(info.description); @@ -65,7 +66,7 @@ wxNativeFontInfo::wxNativeFontInfo(const wxNativeFontInfo& info) description = NULL; } -wxNativeFontInfo::~wxNativeFontInfo() +wxNativeFontInfo::Free() { if (description) pango_font_description_free(description);