summaryrefslogtreecommitdiff
path: root/gtk/gtktextbtree.c
diff options
context:
space:
mode:
authorSébastien Wilmet <swilmet@gnome.org>2014-04-11 17:45:50 +0200
committerMatthias Clasen <mclasen@redhat.com>2014-04-13 14:04:12 -0700
commit983a03d5f85f4e10f5392df2fd2de0c0bf670f7d (patch)
treebcfda4f1b7553c5f0f40b4c5a6d76ec9e8615b2d /gtk/gtktextbtree.c
parentd69d57afa7d1966ab5ebc26bfe9eb1b24ba01571 (diff)
downloadgtk+-983a03d5f85f4e10f5392df2fd2de0c0bf670f7d.tar.gz
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
Diffstat (limited to 'gtk/gtktextbtree.c')
-rw-r--r--gtk/gtktextbtree.c7
1 files changed, 4 insertions, 3 deletions
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 */