From 983a03d5f85f4e10f5392df2fd2de0c0bf670f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Wilmet?= Date: Fri, 11 Apr 2014 17:45:50 +0200 Subject: GtkTextView: use GSlice to allocate GtkTextLineSegment's Use GSlice to allocate all types of segments: - char - toggle - mark - pixbuf - child widget Char segments are a bit more complicated because the length of the text is determined at run time and stored in the 'byte_count' field. If the text is long, GSlice will call the system malloc() anyway, so it's better to always use GSlice for GtkTextLineSegment. Toggle segments are also freed in gtktextbtree.c, hence the function _gtk_toggle_segment_free() (for a later commit it would be nice to rename those functions with the _gtk_text prefix). https://bugzilla.gnome.org/show_bug.cgi?id=727908 --- gtk/gtktextbtree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gtk/gtktextbtree.c') diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index a7c86c5120..825eb95693 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -65,6 +65,7 @@ #include "gtktextiterprivate.h" #include "gtkdebug.h" #include "gtktextmarkprivate.h" +#include "gtktextsegment.h" /* * Types @@ -901,9 +902,9 @@ _gtk_text_btree_delete (GtkTextIter *start, * cleanup_line() below. See bug 317125. */ next2 = prev_seg->next->next; - g_free ((char *)prev_seg->next); + _gtk_toggle_segment_free (prev_seg->next); prev_seg->next = next2; - g_free ((char *)seg); + _gtk_toggle_segment_free (seg); seg = NULL; } else @@ -1952,7 +1953,7 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig, seg->body.toggle.inNodeCounts = FALSE; } - g_free (seg); + _gtk_toggle_segment_free (seg); /* We only clean up lines when we're done with them, saves some gratuitous line-segment-traversals */ -- cgit v1.2.1