Free the lines even if there are no views. (#408018, Albert Huang)

2007-02-15  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtktextbtree.c (_gtk_text_btree_delete): Free the lines
        even if there are no views.  (#408018, Albert Huang)



svn path=/branches/gtk-2-10/; revision=17303
This commit is contained in:
Matthias Clasen
2007-02-15 20:44:28 +00:00
committed by Matthias Clasen
parent a4d9b7b14e
commit dd83258aaf
2 changed files with 18 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
2007-02-15 Matthias Clasen <mclasen@redhat.com>
Merged from trunk:
* gtk/gtktextbtree.c (_gtk_text_btree_delete): Free the lines
even if there are no views. (#408018, Albert Huang)
2007-02-15 Cody Russell <bratsche@gnome.org>
Backport from trunk:

View File

@@ -738,6 +738,7 @@ _gtk_text_btree_delete (GtkTextIter *start,
GtkTextBTree *tree;
GtkTextLine *start_line;
GtkTextLine *end_line;
GtkTextLine *line;
GtkTextLine *deleted_lines = NULL; /* List of lines we've deleted */
gint start_byte_offset;
@@ -989,7 +990,6 @@ _gtk_text_btree_delete (GtkTextIter *start,
view = tree->views;
while (view)
{
GtkTextLine *line;
GtkTextLineData *ld;
gint deleted_width = 0;
@@ -1007,9 +1007,6 @@ _gtk_text_btree_delete (GtkTextIter *start,
deleted_height += ld->height;
}
if (!view->next)
gtk_text_line_destroy (tree, line);
line = next_line;
}
@@ -1043,6 +1040,16 @@ _gtk_text_btree_delete (GtkTextIter *start,
view = view->next;
}
line = deleted_lines;
while (line)
{
GtkTextLine *next_line = line->next;
gtk_text_line_destroy (tree, line);
line = next_line;
}
/* avoid dangling pointer */
deleted_lines = NULL;