0.8.8claws118
authorChristoph Hohmann <reboot@gmx.ch>
Sun, 19 Jan 2003 11:17:31 +0000 (11:17 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sun, 19 Jan 2003 11:17:31 +0000 (11:17 +0000)
* src/procmsg.c
        fix infinite loop in procmsg_find_children

ChangeLog.claws
configure.ac
src/procmsg.c

index 7f5fa64c3836549d2ca42d1e97a002d56036ed7c..a384928da1f4e6bf6cbf807b38e29cc430ceb69a 100644 (file)
@@ -1,3 +1,10 @@
+2003-01-19 [christoph] 0.8.8claws118
+
+       * src/procmsg.c
+               fix infinite loop in procmsg_find_children
+
+       Patch submitted by Ivan F. Martinez <ivanfm@users.sourceforge.net>
+
 2003-01-19 [paul]      0.8.8claws117
 
        * po/pt_BR.po
 2003-01-19 [paul]      0.8.8claws117
 
        * po/pt_BR.po
index d321bea5d4764ef8bd20437d566c1a804615d84e..88dc6da50756658bed9c6c62abbb70b9011d09f9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws117
+EXTRA_VERSION=claws118
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index f1cd5a3d7e1d30b117592c60b4295148a952e714..2a05588f5066e333e8da48931c805cc6e1e90143 100644 (file)
@@ -1689,26 +1689,46 @@ gboolean procmsg_msg_has_marked_parent(MsgInfo *info)
 }
 
 
 }
 
 
-GSList *procmsg_find_children (MsgInfo *info)
+GSList *procmsg_find_children_func(MsgInfo *info, 
+                                  GSList *children, GSList *all)
 {
 {
-       GSList *children = NULL;
-       GSList *all, *cur;
+       GSList *cur;
 
 
-       g_return_val_if_fail(info!=NULL, NULL);
+       g_return_val_if_fail(info!=NULL, children);
        if (info->msgid == NULL)
        if (info->msgid == NULL)
-               return NULL;
-       all = folder_item_get_msg_list(info->folder);
+               return children;
+
        for (cur = all; cur != NULL; cur = g_slist_next(cur)) {
                MsgInfo *tmp = (MsgInfo *)cur->data;
                if (tmp->inreplyto && !strcmp(tmp->inreplyto, info->msgid)) {
        for (cur = all; cur != NULL; cur = g_slist_next(cur)) {
                MsgInfo *tmp = (MsgInfo *)cur->data;
                if (tmp->inreplyto && !strcmp(tmp->inreplyto, info->msgid)) {
-                       GSList *grand_children;
-                       children = g_slist_prepend(children, tmp);
-                       grand_children = procmsg_find_children(tmp);
-                       children = slist_concat_unique(children, grand_children);
-                       g_slist_free(grand_children);
+                       /* Check if message is already in the list */
+                       if ((children == NULL) || 
+                           (g_slist_index(children, tmp) == -1)) {
+                               children = g_slist_prepend(children,
+                                               procmsg_msginfo_new_ref(tmp));
+                               children = procmsg_find_children_func(tmp, 
+                                                       children, 
+                                                       all);
+                       }
+               }
+       }
+       return children;
+}
+
+GSList *procmsg_find_children (MsgInfo *info)
+{
+       GSList *children;
+       GSList *all, *cur;
+
+       g_return_val_if_fail(info!=NULL, NULL);
+       all = folder_item_get_msg_list(info->folder);
+       children = procmsg_find_children_func(info, NULL, all);
+       if (children != NULL) {
+               for (cur = all; cur != NULL; cur = g_slist_next(cur)) {
+                       /* this will not free the used pointers
+                          created with procmsg_msginfo_new_ref */
+                       procmsg_msginfo_free((MsgInfo *)cur->data);
                }
                }
-               if (tmp && tmp != info)
-                       procmsg_msginfo_free(tmp);
        }
        g_slist_free(all);
 
        }
        g_slist_free(all);