aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-thread.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-07-08 05:21:16 +0800
committerDan Winship <danw@src.gnome.org>2000-07-08 05:21:16 +0800
commit2b29d7310a6287f425f8f8ebe73fa0ace7f58f4f (patch)
tree3f4cc9c1fa6af99cd6acd39d058aa3beee6feb14 /mail/message-thread.c
parent2d33aa8a7781502e3d5297409dda389553cc8953 (diff)
downloadgsoc2013-evolution-2b29d7310a6287f425f8f8ebe73fa0ace7f58f4f.tar.gz
gsoc2013-evolution-2b29d7310a6287f425f8f8ebe73fa0ace7f58f4f.tar.zst
gsoc2013-evolution-2b29d7310a6287f425f8f8ebe73fa0ace7f58f4f.zip
Add another argument "clast" pointing to the container before the current
* message-thread.c (remove_node): Add another argument "clast" pointing to the container before the current one in the list, which it can update if that turns out to be the one that it removed. (group_root_set): Update for remove_node change, and remove both nodes in the "subjects are common" case. Fixes a bug that would cause the message list to be truncated if this rule was invoked. svn path=/trunk/; revision=3961
Diffstat (limited to 'mail/message-thread.c')
-rw-r--r--mail/message-thread.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mail/message-thread.c b/mail/message-thread.c
index 789536ba34..9c0325ed21 100644
--- a/mail/message-thread.c
+++ b/mail/message-thread.c
@@ -208,7 +208,7 @@ get_root_subject(struct _container *c, int *re)
/* this is pretty slow, but not used often */
static void
-remove_node(struct _container **list, struct _container *node)
+remove_node(struct _container **list, struct _container *node, struct _container **clast)
{
struct _container *c;
@@ -216,6 +216,8 @@ remove_node(struct _container **list, struct _container *node)
c = (struct _container *)list;
while (c->next) {
if (c->next == node) {
+ if (clast && *clast == c->next)
+ *clast = c;
c->next = c->next->next;
break;
}
@@ -266,7 +268,7 @@ group_root_set(struct _container **cp)
continue;
} if (c->message == NULL && container->message != NULL) {
d(printf("container is non-empty parent\n"));
- remove_node(cp, container);
+ remove_node(cp, container, &clast);
container_add_child(c, container);
} else if (c->message != NULL && container->message == NULL) {
d(printf("container is empty child\n"));
@@ -280,12 +282,13 @@ group_root_set(struct _container **cp)
continue;
} else if (!c->re && container->re) {
d(printf("container is not re\n"));
- remove_node(cp, container);
+ remove_node(cp, container, &clast);
container_add_child(c, container);
} else {
d(printf("subjects are common %p and %p\n", c, container));
- remove_node(cp, container);
+ remove_node(cp, container, &clast);
+ remove_node(cp, c, &clast);
scan = g_malloc0(sizeof(*scan));
scan->root_subject = c->root_subject;
@@ -477,7 +480,7 @@ thread_messages(CamelFolder *folder, GPtrArray *uids)
#if 0
printf("finished\n");
i = dump_tree(head, 0);
- printf("%d count, %d msgs initially, %d items in tree\n", count, msgs, i);
+ printf("%d count, %d items in tree\n", uids->len, i);
#endif
sort_thread(&head);