From c0230162c8b7baf289c5ea478be8ac46b0902a60 Mon Sep 17 00:00:00 2001 From: Adrian Robert Date: Sat, 19 Jul 2008 17:13:48 +0000 Subject: [PATCH] nsfont.m: duplicate UTF8Strings before modifying with nsfont_escape_family_name - patch due to Seiji Zenitani --- src/ChangeLog | 6 ++++++ src/nsfont.m | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 95ccdc5f303..d395861dfa1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-07-19 Adrian Robert + + * nsfont.m (nsfont_fmember_to_entity, nsfont_make_fontset_for_font): + strdup() the family UTF8String before modifying it. Patch due to + Seiji Zenitani. + 2008-07-19 Adrian Robert * nsfns.m (ns_set_background_color): Apply patch from Chong Yidong to diff --git a/src/nsfont.m b/src/nsfont.m index d6aa9ac65e5..bf15ee84933 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -150,7 +150,7 @@ nsfont_fmember_to_entity (NSString *family, NSArray *famMember) unsigned int traits = [[famMember objectAtIndex: 3] unsignedIntValue]; /* NSString *psName = [famMember objectAtIndex: 0]; */ NSMutableString *suffix = [[famMember objectAtIndex: 1] mutableCopy]; - char *escapedFamily = [family UTF8String]; + char *escapedFamily = strdup ([family UTF8String]); nsfont_escape_name (escapedFamily); [suffix replaceOccurrencesOfString: @" " withString: @"" options: 0 @@ -181,6 +181,7 @@ nsfont_fmember_to_entity (NSString *family, NSArray *famMember) } [suffix release]; + free (escapedFamily); return font_entity; } @@ -1226,7 +1227,7 @@ void nsfont_make_fontset_for_font (Lisp_Object name, Lisp_Object font_object) if (cfont != nil) { - char *family = [[cfont familyName] UTF8String]; + char *family = strdup([[cfont familyName] UTF8String]); Lisp_Object famAndReg; nsfont_escape_name (family); @@ -1238,6 +1239,7 @@ void nsfont_make_fontset_for_font (Lisp_Object name, Lisp_Object font_object) SDATA (SYMBOL_NAME (scripts[i]))); Fset_fontset_font (name, scripts[i], famAndReg, Qnil, Qnil); + free (family); } else { -- 2.39.2