2005-08-20 [colin] 1.9.13cvs44
authorColin Leroy <colin@colino.net>
Sat, 20 Aug 2005 18:21:39 +0000 (18:21 +0000)
committerColin Leroy <colin@colino.net>
Sat, 20 Aug 2005 18:21:39 +0000 (18:21 +0000)
* src/folder.c
Fix buf #787 (multilevel delete causes SIGSEGV)

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/folder.c

index 2675c6ee5495c268c259e81209d1872f3ffc9351..cb4271889447cee7c7f036a990cbf60bdb5e0e37 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-20 [colin]     1.9.13cvs44
+
+       * src/folder.c
+               Fix buf #787 (multilevel delete causes SIGSEGV)
+
 2005-08-19 [colin]     1.9.13cvs43
 
        * src/inc.c
index f9e0c26d3104d82b510e221a86281a77090be865..9eca383d4e7e00811c3293ced22800a1fd23b4e2 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.152 -r 1.382.2.153 src/compose.c;  cvs diff -u -r 1.204.2.52 -r 1.204.2.53 src/prefs_common.c;  cvs diff -u -r 1.103.2.25 -r 1.103.2.26 src/prefs_common.h;  cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/prefs_wrapping.c;  ) > 1.9.13cvs41.patchset
 ( cvs diff -u -r 1.382.2.153 -r 1.382.2.154 src/compose.c;  cvs diff -u -r 1.49.2.54 -r 1.49.2.55 src/procmime.c;  cvs diff -u -r 1.105.2.31 -r 1.105.2.32 src/prefs_account.c;  ) > 1.9.13cvs42.patchset
 ( cvs diff -u -r 1.149.2.31 -r 1.149.2.32 src/inc.c;  cvs diff -u -r 1.204.2.53 -r 1.204.2.54 src/prefs_common.c;  cvs diff -u -r 1.103.2.26 -r 1.103.2.27 src/prefs_common.h;  ) > 1.9.13cvs43.patchset
+( cvs diff -u -r 1.213.2.52 -r 1.213.2.53 src/folder.c;  ) > 1.9.13cvs44.patchset
index 7e39be88a5adb87050dc59ce94085fdd5f2e7762..b89323f68c92b5afbae345338313f9d77ec50c11 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=43
+EXTRA_VERSION=44
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 1ff7460255515aeaf2afcab3dd6b7b7a584791a1..9780f7daaf89b908b36fb996e3f85d4ddee6f33a 100644 (file)
@@ -313,11 +313,32 @@ void folder_item_append(FolderItem *parent, FolderItem *item)
        g_node_append(parent->node, item->node);
 }
 
-static gboolean folder_item_remove_func(GNode *node, gpointer data)
+void folder_item_remove(FolderItem *item)
 {
-       FolderItem *item = FOLDER_ITEM(node->data);
+       GNode *node, *start_node;
        FolderUpdateData hookdata;
 
+       g_return_if_fail(item != NULL);
+       g_return_if_fail(item->folder != NULL);
+       g_return_if_fail(item->folder->node != NULL);
+
+       start_node = node = item->node;
+       
+       node = item->folder->node;
+       
+       node = g_node_find(node, G_PRE_ORDER, G_TRAVERSE_ALL, item);
+       node = node->children;
+
+       /* remove my children */
+       while (node != NULL) {
+               if (node && node->data) {
+                       FolderItem *sub_item = (FolderItem*) node->data;
+                       node = node->next;
+                       folder_item_remove(sub_item);
+               }
+       }
+       
+       /* remove myself */
        if (item->cache != NULL) {
                msgcache_destroy(item->cache);
                item->cache = NULL;
@@ -328,25 +349,13 @@ static gboolean folder_item_remove_func(GNode *node, gpointer data)
        hookdata.item = item;
        hooks_invoke(FOLDER_UPDATE_HOOKLIST, &hookdata);
 
-       folder_item_destroy(item);
-
-       return FALSE;
-}
-
-void folder_item_remove(FolderItem *item)
-{
-       GNode *node;
-
-       g_return_if_fail(item != NULL);
-       g_return_if_fail(item->folder != NULL);
-       g_return_if_fail(item->node != NULL);
-       node = item->node;
+       node = start_node;
 
        if (item->folder->node == node)
                item->folder->node = NULL;
 
-       g_node_traverse(node, G_POST_ORDER, G_TRAVERSE_ALL, -1,
-                       folder_item_remove_func, NULL);
+       folder_item_destroy(item);
+
        g_node_destroy(node);
 }