use wxGtkString instead of manual g_free()s (also fixed free/g_free mismatch)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-05-06 21:59:15 +00:00
parent 7e25260c0d
commit 8361f92be8

View File

@@ -143,7 +143,8 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
if ( !family_name ) if ( !family_name )
return ret; return ret;
char *family_text = g_ascii_strdown( family_name, strlen( family_name ) ); wxGtkString family_text(g_ascii_strdown(family_name, strlen(family_name)));
// Check for some common fonts, to salvage what we can from the current win32 centric wxFont API: // Check for some common fonts, to salvage what we can from the current win32 centric wxFont API:
if (strncmp( family_text, "monospace", 9 ) == 0) if (strncmp( family_text, "monospace", 9 ) == 0)
ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace" ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace"
@@ -201,7 +202,6 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
ret = wxFONTFAMILY_DECORATIVE; // Begins with "Old" - "Old English", "Old Town" ret = wxFONTFAMILY_DECORATIVE; // Begins with "Old" - "Old English", "Old Town"
} }
free(family_text);
return ret; return ret;
} }
@@ -312,11 +312,9 @@ bool wxNativeFontInfo::FromString(const wxString& s)
wxString wxNativeFontInfo::ToString() const wxString wxNativeFontInfo::ToString() const
{ {
char *str = pango_font_description_to_string( description ); wxGtkString str(pango_font_description_to_string( description ));
wxString tmp = wxGTK_CONV_BACK( str );
g_free( str );
return tmp; return wxGTK_CONV_BACK(str);
} }
bool wxNativeFontInfo::FromUserString(const wxString& s) bool wxNativeFontInfo::FromUserString(const wxString& s)