[gtk+] textlayout: avoid double-free when adding preedit color
- From: Daiki Ueno <dueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] textlayout: avoid double-free when adding preedit color
- Date: Tue, 9 Jul 2013 04:21:45 +0000 (UTC)
commit 837a0d3e4002e640be2aea2a67802c474997e354
Author: Daiki Ueno <ueno unixuser org>
Date: Wed Jul 3 19:03:30 2013 +0900
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
gtk/gtktextlayout.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index f87714b..f72f384 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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]