Commit 837a0d3e authored by Daiki Ueno's avatar Daiki Ueno

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
parent 50c3eb9a
......@@ -1887,6 +1887,11 @@ add_preedit_attrs (GtkTextLayout *layout,
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));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment