diff options
Diffstat (limited to 'src/plugins/fs/search.c')
-rw-r--r-- | src/plugins/fs/search.c | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c index 9985c4c3..e06a9204 100644 --- a/src/plugins/fs/search.c +++ b/src/plugins/fs/search.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2005 Christian Grothoff (and other contributing authors) | 3 | (C) 2005, 2006 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -192,8 +192,6 @@ static void freeIterSubtree(GtkTreeModel * tree, | |||
192 | freeIterSubtree(tree, &child); | 192 | freeIterSubtree(tree, &child); |
193 | } while (gtk_tree_model_iter_next(tree, | 193 | } while (gtk_tree_model_iter_next(tree, |
194 | iter)); | 194 | iter)); |
195 | |||
196 | |||
197 | } | 195 | } |
198 | 196 | ||
199 | /** | 197 | /** |
@@ -1025,6 +1023,36 @@ void fs_search_start() { | |||
1025 | NULL); | 1023 | NULL); |
1026 | } | 1024 | } |
1027 | 1025 | ||
1026 | static void freeSearchModel(GtkTreeModel * model, | ||
1027 | GtkTreeIter * parent) { | ||
1028 | struct ECRS_URI * u; | ||
1029 | struct ECRS_MetaData * m; | ||
1030 | GtkTreeIter iter; | ||
1031 | |||
1032 | if (gtk_tree_model_iter_children(model, | ||
1033 | &iter, | ||
1034 | parent)) { | ||
1035 | do { | ||
1036 | gtk_tree_model_get(model, | ||
1037 | &iter, | ||
1038 | SEARCH_URI, &u, | ||
1039 | SEARCH_META, &m, | ||
1040 | -1); | ||
1041 | gtk_tree_store_set(GTK_TREE_STORE(model), | ||
1042 | &iter, | ||
1043 | SEARCH_URI, NULL, | ||
1044 | SEARCH_META, NULL, | ||
1045 | -1); | ||
1046 | if (u != NULL) | ||
1047 | ECRS_freeUri(u); | ||
1048 | if (m != NULL) | ||
1049 | ECRS_freeMetaData(m); | ||
1050 | freeSearchModel(model, &iter); | ||
1051 | } while (gtk_tree_model_iter_next(model, | ||
1052 | &iter)); | ||
1053 | } | ||
1054 | } | ||
1055 | |||
1028 | void fs_search_stop() { | 1056 | void fs_search_stop() { |
1029 | SearchList * list; | 1057 | SearchList * list; |
1030 | GtkTreeIter iter; | 1058 | GtkTreeIter iter; |
@@ -1037,33 +1065,7 @@ void fs_search_stop() { | |||
1037 | list = head; | 1065 | list = head; |
1038 | head = head->next; | 1066 | head = head->next; |
1039 | ECRS_freeUri(list->uri); | 1067 | ECRS_freeUri(list->uri); |
1040 | 1068 | freeSearchModel(list->model, NULL); | |
1041 | #if 0 | ||
1042 | /* FIXME - memory leak. The following is still incorrect; | ||
1043 | it does not free entire tree (need to recurse!) | ||
1044 | */ | ||
1045 | if (gtk_tree_model_get_iter_first(head->model, | ||
1046 | &iter)) { | ||
1047 | struct ECRS_MetaData * m; | ||
1048 | do { | ||
1049 | gtk_tree_model_get(head->model, | ||
1050 | &iter, | ||
1051 | SEARCH_URI, &u, | ||
1052 | SEARCH_META, &m, | ||
1053 | -1); | ||
1054 | gtk_tree_store_set(GTK_TREE_STORE(head->model), | ||
1055 | &iter, | ||
1056 | SEARCH_URI, NULL, | ||
1057 | SEARCH_META, NULL, | ||
1058 | -1); | ||
1059 | if (u != NULL) | ||
1060 | ECRS_freeUri(u); | ||
1061 | if (m != NULL) | ||
1062 | ECRS_freeMetaData(m); | ||
1063 | } while (gtk_tree_model_iter_next(head->model, | ||
1064 | &iter)); | ||
1065 | } | ||
1066 | #endif | ||
1067 | FREE(list); | 1069 | FREE(list); |
1068 | } | 1070 | } |
1069 | 1071 | ||