diff --git a/gimp-2.8.4-text-selection-crash.patch b/gimp-2.8.4-text-selection-crash.patch new file mode 100644 index 0000000..a1db503 --- /dev/null +++ b/gimp-2.8.4-text-selection-crash.patch @@ -0,0 +1,125 @@ +From 90f9b908951cf0793255215cbd703c847676f8eb Mon Sep 17 00:00:00 2001 +From: Nils Philippsen +Date: Mon, 27 May 2013 17:46:26 +0200 +Subject: [PATCH] patch: text-selection-crash + +Squashed commit of the following: + +commit 44be26742ce317132687f78434e75e5b15f245cd +Author: Michael Natterer +Date: Sun Apr 21 17:51:08 2013 +0200 + + Bug 694417 - GIMP Segmentation Faults (Segfault, Crash) after Changing Color... + + Don't pass a NULL pointer to gimp_text_buffer_get_font_tag() because + it is dereferenced in a call to strcmp(). + + gimp_context_get_font_name() returns NULL when the selected text + includes spans with different fonts. Add the same special handling for + spans with inconsistent sizes too, and add comments that we should + have the same for the color. + + Original patch from Massimo Valentini. + (cherry picked from commit 804313bbecf92e099952ef0b9e12824d57100ccd) +--- + app/widgets/gimptextstyleeditor.c | 50 +++++++++++++++++++++++++-------------- + 1 file changed, 32 insertions(+), 18 deletions(-) + +diff --git a/app/widgets/gimptextstyleeditor.c b/app/widgets/gimptextstyleeditor.c +index 9fe6580..853fee3 100644 +--- a/app/widgets/gimptextstyleeditor.c ++++ b/app/widgets/gimptextstyleeditor.c +@@ -562,26 +562,29 @@ gimp_text_style_editor_list_tags (GimpTextStyleEditor *editor, + } + + { +- 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 *editor, + *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); +@@ -767,6 +779,8 @@ gimp_text_style_editor_set_color (GimpTextStyleEditor *editor, + gimp_color_button_set_color (GIMP_COLOR_BUTTON (editor->color_button), + &color); + ++ /* FIXME should have "inconsistent" state as for font and size */ ++ + g_signal_handlers_unblock_by_func (editor->color_button, + gimp_text_style_editor_color_changed, + editor); +-- +1.8.1.4 + diff --git a/gimp.spec b/gimp.spec index 3d8956b..eeef0dc 100644 --- a/gimp.spec +++ b/gimp.spec @@ -220,6 +220,9 @@ Patch5: gimp-2.8.4-script-fu-gradient.patch # Fix crashes in unsharp-mask plug-in. # Upstream commit 38d8312fdebee98a20b33807b09d8a832a4b97b7 Patch6: gimp-2.8.4-unsharp-mask-crash.patch +# Fix crashes when selecting text with multiple colors etc. +# Upstream commit 44be26742ce317132687f78434e75e5b15f245cd +Patch7: gimp-2.8.4-text-selection-crash.patch %description GIMP (GNU Image Manipulation Program) is a powerful image composition and @@ -312,6 +315,7 @@ EOF %patch4 -p1 -b .tag-popup-crash %patch5 -p1 -b .script-fu-gradient %patch6 -p1 -b .unsharp-mask-crash +%patch7 -p1 -b .text-selection-crash %build %if %{with hardening} @@ -621,6 +625,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : - fix double-free crashes when selecting gradients from script-fu (#964470) - fix crash in unsharp-mask plug-in (#966987) - hardcode python interpreter in python plug-ins (#952227) +- fix crash when selecting text with multiple colors etc. (#919795, #951815) * Sat Apr 20 2013 Nils Philippsen - 2:2.8.4-3 - don't crash upon deleting tags in popup (#892828)