[gimp/gimp-2-8] Bug 689523 - GIMP crashes (segfault) when loading a context with a font...



commit 6a39d214947da4aba7354d25655065f9d42456c2
Author: Michael Natterer <mitch gimp org>
Date:   Fri Jan 18 01:02:31 2013 +0100

    Bug 689523 - GIMP crashes (segfault) when loading a context with a font...
    
    Make gimp_context_get|set_font_name() actually deal with
    context->font_name, so the context can do its job of keeping the name
    of an unavailable object around.
    (cherry picked from commit c262fee2445734c015aafe527cb681eed6941ec4)

 app/core/gimpcontext.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c
index 250b9f8..5ba280a 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -3172,7 +3172,7 @@ gimp_context_get_font_name (GimpContext *context)
 {
   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
 
-  return (context->font ? gimp_object_get_name (context->font) : NULL);
+  return context->font_name;
 }
 
 void
@@ -3185,7 +3185,20 @@ gimp_context_set_font_name (GimpContext *context,
 
   font = gimp_container_get_child_by_name (context->gimp->fonts, name);
 
-  gimp_context_set_font (context, GIMP_FONT (font));
+  if (font)
+    {
+      gimp_context_set_font (context, GIMP_FONT (font));
+    }
+  else
+    {
+      /* No font with this name exists, use the standard font, but
+       * keep the intended name around
+       */
+      gimp_context_set_font (context, gimp_font_get_standard ());
+
+      g_free (context->font_name);
+      context->font_name = g_strdup (name);
+    }
 }
 
 void



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