[gimp] Bug 742775: Crash when editing text with certain fonts



commit 09c5fcc32bb0ee8d068ccaed7ef4761881747df2
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Tue Feb 3 18:33:12 2015 +0100

    Bug 742775: Crash when editing text with certain fonts

 app/widgets/gimptextbuffer.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimptextbuffer.c b/app/widgets/gimptextbuffer.c
index d1fdc56..6c5da93 100644
--- a/app/widgets/gimptextbuffer.c
+++ b/app/widgets/gimptextbuffer.c
@@ -827,6 +827,10 @@ gimp_text_buffer_get_font_tag (GimpTextBuffer *buffer,
   GList      *list;
   GtkTextTag *tag;
   gchar       name[256];
+  PangoFontDescription *pfd = pango_font_description_from_string (font);
+  char *description = pango_font_description_to_string (pfd);
+
+  pango_font_description_free (pfd);
 
   for (list = buffer->font_tags; list; list = g_list_next (list))
     {
@@ -836,22 +840,23 @@ gimp_text_buffer_get_font_tag (GimpTextBuffer *buffer,
 
       tag_font = gimp_text_tag_get_font (tag);
 
-      if (! strcmp (font, tag_font))
+      if (! strcmp (description, tag_font))
         {
           g_free (tag_font);
+          g_free (description);
           return tag;
         }
 
       g_free (tag_font);
     }
 
-  g_snprintf (name, sizeof (name), "font-%s", font);
+  g_snprintf (name, sizeof (name), "font-%s", description);
 
   tag = gtk_text_buffer_create_tag (GTK_TEXT_BUFFER (buffer),
                                     name,
-                                    "font", font,
+                                    "font", description,
                                     NULL);
-
+  g_free (description);
   buffer->font_tags = g_list_prepend (buffer->font_tags, tag);
 
   return tag;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]