]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxGTK crash on startup on 64-bit solaris 10
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Tue, 20 Sep 2005 12:01:54 +0000 (12:01 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Tue, 20 Sep 2005 12:01:54 +0000 (12:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/fontutil.cpp

index 84d09f9931dd80845ff6d33e0ab589ec785796ee..f58ac651073eb0591916305b7fb7e20947d290a5 100644 (file)
@@ -139,7 +139,11 @@ wxString wxNativeFontInfo::GetFaceName() const
 wxFontFamily wxNativeFontInfo::GetFamily() const
 {
     wxFontFamily ret = wxFONTFAMILY_DEFAULT;
-    char *family_text = g_ascii_strdown( pango_font_description_get_family( description ), -1 );
+    // note: not passing -1 as the 2nd parameter to g_ascii_strdown to work
+    // 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 );
     // 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"