changeset 5824:6928877dbc26

Fix breakage caused by previous commit. 2014-10-25 Michael Sperber <mike@xemacs.org> * fontcolor-x.c (x_font_instance_truename): * font-mgr.c (Ffc_name_unparse): * font-mgr.h (PRINT_XFT_PATTERN, PRINT_XFT_PATTERN): Don't modify fontconfig pattern passed in in place.
author Mike Sperber <sperber@deinprogramm.de>
date Sat, 25 Oct 2014 15:59:31 +0200
parents efb76d6d0c1d
children 5d5aeb79edb4
files src/ChangeLog src/font-mgr.c src/font-mgr.h src/fontcolor-x.c
diffstat 4 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Oct 20 16:35:18 2014 +0900
+++ b/src/ChangeLog	Sat Oct 25 15:59:31 2014 +0200
@@ -1,3 +1,10 @@
+2014-10-25  Michael Sperber  <mike@xemacs.org>
+
+	* fontcolor-x.c (x_font_instance_truename): 
+	* font-mgr.c (Ffc_name_unparse): 
+	* font-mgr.h (PRINT_XFT_PATTERN): Don't modify
+	fontconfig pattern passed in in place.
+
 2014-10-18  Aidan Kehoe  <kehoea@parhasard.net>
 
 	Some changes to eliminate warnings with Apple clang version 1.7.
--- a/src/font-mgr.c	Mon Oct 20 16:35:18 2014 +0900
+++ b/src/font-mgr.c	Sat Oct 25 15:59:31 2014 +0200
@@ -266,9 +266,12 @@
 
   CHECK_FC_PATTERN (pattern);
   /* #### Could use multiple values here to extract and return charset? */
-  FcPatternDel (XFC_PATTERN_PTR (pattern), FC_CHARSET);
-
-  name = FcNameUnparse (XFC_PATTERN_PTR (pattern));
+  {
+    FcPattern* temp = FcPatternDuplicate (XFC_PATTERN_PTR (pattern));
+    FcPatternDel (temp, FC_CHARSET);
+    name = FcNameUnparse (XFC_PATTERN_PTR (pattern));
+    FcPatternDestroy (temp);
+  }
   result = build_fcapi_string (name);
   xfree (name);
   return result;
--- a/src/font-mgr.h	Mon Oct 20 16:35:18 2014 +0900
+++ b/src/font-mgr.h	Sat Oct 25 15:59:31 2014 +0200
@@ -145,8 +145,10 @@
   do {								\
     DECLARE_EISTRING (eistrpxft_name);				\
     Extbyte *name;						\
-    FcPatternDel(pattern, FC_CHARSET);				\
-    name = (Extbyte *) FcNameUnparse (pattern);			\
+    FcPattern* temp = FcPatternDuplicate (pattern);		\
+    FcPatternDel (temp, FC_CHARSET);				\
+    name = (Extbyte *) FcNameUnparse (temp);			\
+    FcPatternDestroy (temp);					\
     eicpy_ext(eistrpxft_name,					\
               name ? name : "FONT WITH NULL NAME",		\
               Qfc_font_name_encoding);				\
--- a/src/fontcolor-x.c	Mon Oct 20 16:35:18 2014 +0900
+++ b/src/fontcolor-x.c	Sat Oct 25 15:59:31 2014 +0200
@@ -763,8 +763,12 @@
 			      "Xft font present but lacks pattern",
 			      wrap_font_instance(f), Qfont, errb);
 	}
-      FcPatternDel (pattern, FC_CHARSET);  /* FcNameUnparse may choke */
-      res = FcNameUnparse (pattern);
+      {
+	FcPattern* temp = FcPatternDuplicate (pattern);
+	FcPatternDel (temp, FC_CHARSET);  /* FcNameUnparse may choke */
+	res = FcNameUnparse (temp);
+	FcPatternDestroy (temp);
+      }
       if (res)
 	{
 	  FONT_INSTANCE_TRUENAME (f) =