Backport fix for bug 694417, gimp segfaults after changing color of text blocks

https://bugzilla.gnome.org/show_bug.cgi?id=694417

spotted by william.os4y
This commit is contained in:
giovanni 2014-01-08 18:26:01 +00:00
parent 2f83a09afb
commit 098a41d2cf
2 changed files with 89 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.94 2013/12/15 19:54:00 jasper Exp $
# $OpenBSD: Makefile,v 1.95 2014/01/08 18:26:01 giovanni Exp $
COMMENT= GNU Image Manipulation Program
SHARED_ONLY= Yes
DISTNAME= gimp-2.8.4
REVISION= 4
REVISION= 5
SHARED_LIBS+= gimp-2.0 272.0 # 800.0
SHARED_LIBS+= gimpbase-2.0 272.0 # 800.0

View File

@ -0,0 +1,87 @@
$OpenBSD: patch-app_widgets_gimptextstyleeditor_c,v 1.1 2014/01/08 18:26:01 giovanni Exp $
Changing color of text blocks leads to segfault
https://bugzilla.gnome.org/show_bug.cgi?id=694417
--- app/widgets/gimptextstyleeditor.c.orig Fri Dec 14 21:14:21 2012
+++ app/widgets/gimptextstyleeditor.c Wed Jan 8 18:41:33 2014
@@ -562,26 +562,29 @@ gimp_text_style_editor_list_tags (GimpTextStyleEditor
}
{
- GtkTextTag *tag;
- GList *list;
- gdouble pixels;
- gdouble points;
+ GList *list;
+ gdouble pixels;
for (list = editor->buffer->size_tags; list; list = g_list_next (list))
*remove_tags = g_list_prepend (*remove_tags, list->data);
pixels = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (editor->size_entry), 0);
- points = gimp_units_to_points (pixels,
- GIMP_UNIT_PIXEL,
- editor->resolution_y);
- tag = gimp_text_buffer_get_size_tag (editor->buffer,
- PANGO_SCALE * points);
- tags = g_list_prepend (tags, tag);
+ if (pixels != 0.0)
+ {
+ GtkTextTag *tag;
+ gdouble points;
+
+ points = gimp_units_to_points (pixels,
+ GIMP_UNIT_PIXEL,
+ editor->resolution_y);
+ tag = gimp_text_buffer_get_size_tag (editor->buffer,
+ PANGO_SCALE * points);
+ tags = g_list_prepend (tags, tag);
+ }
}
{
- GtkTextTag *tag;
GList *list;
const gchar *font_name;
@@ -589,24 +592,33 @@ gimp_text_style_editor_list_tags (GimpTextStyleEditor
*remove_tags = g_list_prepend (*remove_tags, list->data);
font_name = gimp_context_get_font_name (editor->context);
- tag = gimp_text_buffer_get_font_tag (editor->buffer, font_name);
- tags = g_list_prepend (tags, tag);
+ if (font_name)
+ {
+ GtkTextTag *tag;
+
+ tag = gimp_text_buffer_get_font_tag (editor->buffer, font_name);
+ tags = g_list_prepend (tags, tag);
+ }
}
{
- GtkTextTag *tag;
- GList *list;
- GimpRGB color;
+ GList *list;
+ GimpRGB color;
for (list = editor->buffer->color_tags; list; list = g_list_next (list))
*remove_tags = g_list_prepend (*remove_tags, list->data);
gimp_color_button_get_color (GIMP_COLOR_BUTTON (editor->color_button),
&color);
- tag = gimp_text_buffer_get_color_tag (editor->buffer, &color);
- tags = g_list_prepend (tags, tag);
+ if (TRUE) /* FIXME should have "inconsistent" state as for font and size */
+ {
+ GtkTextTag *tag;
+
+ tag = gimp_text_buffer_get_color_tag (editor->buffer, &color);
+ tags = g_list_prepend (tags, tag);
+ }
}
*remove_tags = g_list_reverse (*remove_tags);