After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703533 - textlayout: avoid double-free when adding preedit color
textlayout: avoid double-free when adding preedit color
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-07-03 10:32 UTC by Daiki Ueno
Modified: 2013-07-09 04:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
textlayout: avoid double-free when adding preedit color (1.87 KB, patch)
2013-07-03 10:32 UTC, Daiki Ueno
reviewed Details | Review
textlayout: avoid double-free when adding preedit color (1.43 KB, patch)
2013-07-04 02:10 UTC, Daiki Ueno
committed Details | Review

Description Daiki Ueno 2013-07-03 10:32:10 UTC
I'm sorry, this is a fix for regression caused by my commit 7a9553cf.  There was
 a double-free for original style->appearance.rgba when inserting coloured preedit text with input method.

Downstream bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714625
Comment 1 Daiki Ueno 2013-07-03 10:32:12 UTC
Created attachment 248299 [details] [review]
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.
Comment 2 Jiro Matsuzawa 2013-07-03 15:54:01 UTC
Thank you for the patch. I've encountered this problem. I applied the patch and tested it as a user with gedit and anjuta. It fixed the bug, and the applications worked well.

Thank you.
Comment 3 Matthias Clasen 2013-07-04 00:26:14 UTC
Review of attachment 248299 [details] [review]:

::: gtk/gtktextlayout.c
@@ +1957,3 @@
+	  && appearance.rgba[1] != style->appearance.rgba[1])
+	gdk_rgba_free (appearance.rgba[1]);
+

This is a bit ugly. I'd prefer to always copy the rgba entries when we copy the appearance struct, and then always free it at the end.
Comment 4 Daiki Ueno 2013-07-04 02:10:32 UTC
Created attachment 248359 [details] [review]
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.
--
Revised to copy the rgba entries.  Thanks for the suggestion.
Comment 5 Matthias Clasen 2013-07-09 03:38:55 UTC
Review of attachment 248359 [details] [review]:

thanks, looks good now
Comment 6 Daiki Ueno 2013-07-09 04:21:58 UTC
Attachment 248359 [details] pushed as 837a0d3 - textlayout: avoid double-free when adding preedit color