changeset 96813:ece3c792fb2e

nsfont.m: duplicate UTF8Strings before modifying with nsfont_escape_family_name - patch due to Seiji Zenitani
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Sat, 19 Jul 2008 17:13:48 +0000
parents eb46d3216494
children 2ae5159088f5
files src/ChangeLog src/nsfont.m
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Jul 19 17:01:36 2008 +0000
+++ b/src/ChangeLog	Sat Jul 19 17:13:48 2008 +0000
@@ -1,3 +1,9 @@
+2008-07-19  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* 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  <Adrian.B.Robert@gmail.com>
 
 	* nsfns.m (ns_set_background_color): Apply patch from Chong Yidong to
--- a/src/nsfont.m	Sat Jul 19 17:01:36 2008 +0000
+++ b/src/nsfont.m	Sat Jul 19 17:13:48 2008 +0000
@@ -150,7 +150,7 @@
   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 @@
      }
 
   [suffix release];
+  free (escapedFamily);
   return font_entity;
 }
 
@@ -1226,7 +1227,7 @@
 
         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 @@
                        SDATA (SYMBOL_NAME (scripts[i])));
 
             Fset_fontset_font (name, scripts[i], famAndReg, Qnil, Qnil);
+            free (family);
           }
         else
           {