[gimp/gimp-2-8] Bug 694417 - GIMP Segmentation Faults (Segfault, Crash) after Changing Color...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 694417 - GIMP Segmentation Faults (Segfault, Crash) after Changing Color...
- Date: Sun, 21 Apr 2013 15:55:55 +0000 (UTC)
commit 839734463a96392ad1e2ce26c9c29a8d2fdf1b6e
Author: Michael Natterer <mitch gimp org>
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]