changeset 15313:508e64b12d98

[gaim-migrate @ 18104] How about now? committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 11 Jan 2007 06:21:46 +0000
parents c273952a004d
children 4a4e1dfd8716
files console/libgnt/gnttextview.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gnttextview.c	Thu Jan 11 05:30:24 2007 +0000
+++ b/console/libgnt/gnttextview.c	Thu Jan 11 06:21:46 2007 +0000
@@ -507,6 +507,7 @@
  */
 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all)
 {
+	GList *alllines = g_list_first(view->list);
 	GList *list, *next, *iter, *inext;
 	int count = 0;
 	for (list = view->tags; list; list = next) {
@@ -534,7 +535,7 @@
 			}
 
 			/* Update the offsets of the segments */
-			for (iter = view->list; iter; iter = inext) {
+			for (iter = alllines; iter; iter = inext) {
 				GList *segs, *snext;
 				GntTextLine *line = iter->data;
 				inext = iter->next;
@@ -554,7 +555,13 @@
 							line->segments = g_list_delete_link(line->segments, segs);
 							if (line->segments == NULL) {
 								free_text_line(line, NULL);
-								view->list = g_list_delete_link(view->list, iter);
+								if (view->list == iter) {
+									if (inext)
+										view->list = inext;
+									else
+										view->list = iter->prev;
+								}
+								alllines = g_list_delete_link(alllines, iter);
 							}
 						} else {
 							/* XXX: (null) */