summaryrefslogtreecommitdiff
path: root/gtk/gtktextlayout.c
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2013-07-03 19:03:30 +0900
committerDaiki Ueno <ueno@unixuser.org>2013-07-09 13:21:17 +0900
commit837a0d3e4002e640be2aea2a67802c474997e354 (patch)
tree4b1a4f7e951ceee1b8540cff5ace7ada5cd49b05 /gtk/gtktextlayout.c
parent50c3eb9accf7665e51820f7f95870f6280777dde (diff)
downloadgtk+-837a0d3e4002e640be2aea2a67802c474997e354.tar.gz
textlayout: avoid double-free when adding preedit color
In add_preedit_attrs, don't free foreground/background colors already set in the underlying text attributes (style). They will be free'd by release_style. https://bugzilla.gnome.org/show_bug.cgi?id=703533
Diffstat (limited to 'gtk/gtktextlayout.c')
-rw-r--r--gtk/gtktextlayout.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index f87714bcc7..f72f384973 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1887,6 +1887,11 @@ add_preedit_attrs (GtkTextLayout *layout,
continue;
pango_attr_iterator_get_font (iter, font_desc, &language, &extra_attrs);
+
+ if (appearance.rgba[0])
+ appearance.rgba[0] = gdk_rgba_copy (appearance.rgba[0]);
+ if (appearance.rgba[1])
+ appearance.rgba[1] = gdk_rgba_copy (appearance.rgba[1]);
tmp_list = extra_attrs;
while (tmp_list)
@@ -1947,6 +1952,11 @@ add_preedit_attrs (GtkTextLayout *layout,
attrs, start + offset,
size_only, TRUE);
+ if (appearance.rgba[0])
+ gdk_rgba_free (appearance.rgba[0]);
+ if (appearance.rgba[1])
+ gdk_rgba_free (appearance.rgba[1]);
+
pango_font_description_free (font_desc);
}
while (pango_attr_iterator_next (iter));