X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c23d400420793c80ddf4cfb8a600becfdfb2a2a5..05ae668ce491600cd568edbe15618693e63d619c:/src/unix/fontutil.cpp diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index 3081336057..cc30f65aa1 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -140,7 +140,11 @@ wxFontFamily wxNativeFontInfo::GetFamily() const // around a bug in the 64-bit glib shipped with solaris 10, -1 causes it // to try to allocate 2^32 bytes. const char *family_name = pango_font_description_get_family( description ); - char *family_text = g_ascii_strdown( family_name, family_name ? strlen( family_name ) : 0 ); + if ( !family_name ) + return ret; + + 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: if (strncmp( family_text, "monospace", 9 ) == 0) ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace" @@ -198,7 +202,6 @@ wxFontFamily wxNativeFontInfo::GetFamily() const ret = wxFONTFAMILY_DECORATIVE; // Begins with "Old" - "Old English", "Old Town" } - free(family_text); return ret; } @@ -309,11 +312,9 @@ bool wxNativeFontInfo::FromString(const wxString& s) wxString wxNativeFontInfo::ToString() const { - char *str = pango_font_description_to_string( description ); - wxString tmp = wxGTK_CONV_BACK( str ); - g_free( str ); + wxGtkString str(pango_font_description_to_string( description )); - return tmp; + return wxGTK_CONV_BACK(str); } bool wxNativeFontInfo::FromUserString(const wxString& s)