[gimp/soc-2011-seamless-clone2] Bug 689523 - GIMP crashes (segfault) when loading a context with a font...



commit e46aa2c29b38f220f6eda631a64d75b34ec8f48f
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.

 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 68fbdb6..3bd0c79 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -3228,7 +3228,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
@@ -3241,7 +3241,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]