From cd9a673cd730dc76c000844e7df674cebac4293d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 4 Jan 2003 03:51:13 +0000 Subject: [PATCH] Ensure that the wxNativeFontInfo internal data is copied when the wxFontRefData is. This solves a wxGTK2 problem where the PangoFontDescription pointer is copied by the default assignment operator, in a binary compatible way . git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/font.cpp | 15 +++++++++------ src/gtk1/font.cpp | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 2fd0ad6f5f..23a8b2b1f0 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -95,7 +95,7 @@ public: void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } bool GetNoAntiAliasing() { return m_noAA; } - + // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -158,7 +158,7 @@ private: }; // ---------------------------------------------------------------------------- -// wxFontRefData +// wxFontRefData // ---------------------------------------------------------------------------- void wxFontRefData::Init(int pointSize, @@ -185,7 +185,7 @@ void wxFontRefData::Init(int pointSize, m_underlined = underlined; m_encoding = encoding; - + m_noAA = FALSE; #ifdef __WXGTK20__ @@ -215,7 +215,7 @@ void wxFontRefData::Init(int pointSize, break; } } - + SetStyle( m_style ); SetPointSize( m_pointSize ); SetWeight( m_weight ); @@ -407,8 +407,11 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) m_encoding = data.m_encoding; m_noAA = data.m_noAA; - - m_nativeFontInfo = data.m_nativeFontInfo; + + // Forces a copy of the internal data. wxNativeFontInfo should probably + // have a copy ctor and assignment operator to fix this properly but that + // would break binary compatibility... + m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString()); } wxFontRefData::wxFontRefData(int size, int family, int style, diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 2fd0ad6f5f..23a8b2b1f0 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -95,7 +95,7 @@ public: void SetNoAntiAliasing( bool no = TRUE ) { m_noAA = no; } bool GetNoAntiAliasing() { return m_noAA; } - + // and this one also modifies all the other font data fields void SetNativeFontInfo(const wxNativeFontInfo& info); @@ -158,7 +158,7 @@ private: }; // ---------------------------------------------------------------------------- -// wxFontRefData +// wxFontRefData // ---------------------------------------------------------------------------- void wxFontRefData::Init(int pointSize, @@ -185,7 +185,7 @@ void wxFontRefData::Init(int pointSize, m_underlined = underlined; m_encoding = encoding; - + m_noAA = FALSE; #ifdef __WXGTK20__ @@ -215,7 +215,7 @@ void wxFontRefData::Init(int pointSize, break; } } - + SetStyle( m_style ); SetPointSize( m_pointSize ); SetWeight( m_weight ); @@ -407,8 +407,11 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data ) m_encoding = data.m_encoding; m_noAA = data.m_noAA; - - m_nativeFontInfo = data.m_nativeFontInfo; + + // Forces a copy of the internal data. wxNativeFontInfo should probably + // have a copy ctor and assignment operator to fix this properly but that + // would break binary compatibility... + m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString()); } wxFontRefData::wxFontRefData(int size, int family, int style, -- 2.45.2