diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-10-02 19:54:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-10-02 19:54:42 +0800 |
commit | 09d4af6fff63dd112b8bb42087f14f7018e2f78c (patch) | |
tree | 991537a9ea1d8487334f6fb299098daf425f9db8 /mail/mail-send-recv.c | |
parent | 79521efaeecfbaf717e465670fcd2724aea53578 (diff) | |
download | gsoc2013-evolution-09d4af6fff63dd112b8bb42087f14f7018e2f78c.tar.gz gsoc2013-evolution-09d4af6fff63dd112b8bb42087f14f7018e2f78c.tar.zst gsoc2013-evolution-09d4af6fff63dd112b8bb42087f14f7018e2f78c.zip |
** Fixes bug #469657
2007-10-02 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #469657
* addressbook/importers/evolution-ldif-importer.c:
* calendar/gui/comp-editor-factory.c:
* composer/e-msg-composer.c:
* e-util/e-config-listener.c:
* mail/em-composer-prefs.c:
* mail/em-folder-tree-model.c:
* mail/em-format.c:
* mail/em-format-html.c:
* mail/em-migrate.c:
* mail/em-subscribe-editor.c:
* mail/mail-component.c:
* mail/mail-send-recv.c:
* mail/message-list.c:
* mail/importers/elm-importer.c:
* plugins/exchange-operations/exchange-folder-size-display.c:
* plugins/mono/mono-plugin.c:
* shell/e-shell-settings-dialog.c:
* tools/killev.c:
* widgets/table/e-table-extras.c:
* widgets/table/e-table-selection-model.c:
Use destroy functions in GHashTables to simplify memory management.
svn path=/trunk/; revision=34344
Diffstat (limited to 'mail/mail-send-recv.c')
-rw-r--r-- | mail/mail-send-recv.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index f55415323f..ff6d3d6403 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -134,6 +134,27 @@ static CamelFolder *receive_get_folder(CamelFilterDriver *d, const char *uri, vo static struct _send_data *send_data = NULL; static GtkWidget *send_recv_dialog = NULL; +static void +free_folder_info(struct _folder_info *info) +{ + /*camel_folder_thaw (info->folder); */ + mail_sync_folder(info->folder, NULL, NULL); + camel_object_unref(info->folder); + g_free(info->uri); + g_free(info); +} + +static void +free_send_info(struct _send_info *info) +{ + g_free(info->uri); + camel_operation_unref(info->cancel); + if (info->timeout_id != 0) + g_source_remove(info->timeout_id); + g_free(info->what); + g_free(info); +} + static struct _send_data * setup_send_data(void) { @@ -142,10 +163,16 @@ setup_send_data(void) if (send_data == NULL) { send_data = data = g_malloc0(sizeof(*data)); data->lock = g_mutex_new(); - data->folders = g_hash_table_new(g_str_hash, g_str_equal); + data->folders = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) free_folder_info); data->inbox = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_LOCAL_INBOX); camel_object_ref(data->inbox); - data->active = g_hash_table_new(g_str_hash, g_str_equal); + data->active = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) free_send_info); } return send_data; } @@ -166,27 +193,6 @@ receive_cancel(GtkButton *button, struct _send_info *info) } static void -free_folder_info(void *key, struct _folder_info *info, void *data) -{ - /*camel_folder_thaw (info->folder); */ - mail_sync_folder(info->folder, NULL, NULL); - camel_object_unref(info->folder); - g_free(info->uri); - g_free(info); -} - -static void -free_send_info(void *key, struct _send_info *info, void *data) -{ - g_free(info->uri); - camel_operation_unref(info->cancel); - if (info->timeout_id != 0) - g_source_remove(info->timeout_id); - g_free(info->what); - g_free(info); -} - -static void free_send_data(void) { struct _send_data *data = send_data; @@ -200,9 +206,7 @@ free_send_data(void) } g_list_free(data->infos); - g_hash_table_foreach(data->active, (GHFunc)free_send_info, NULL); g_hash_table_destroy(data->active); - g_hash_table_foreach(data->folders, (GHFunc)free_folder_info, NULL); g_hash_table_destroy(data->folders); g_mutex_free(data->lock); g_free(data); @@ -708,9 +712,9 @@ receive_done (char *uri, void *data) /* remove/free this active download */ d(printf("%s: freeing info %p\n", G_GNUC_FUNCTION, info)); if (info->type == SEND_SEND) - g_hash_table_remove(info->data->active, SEND_URI_KEY); + g_hash_table_steal(info->data->active, SEND_URI_KEY); else - g_hash_table_remove(info->data->active, info->uri); + g_hash_table_steal(info->data->active, info->uri); info->data->infos = g_list_remove(info->data->infos, info); if (g_hash_table_size(info->data->active) == 0) { @@ -719,7 +723,7 @@ receive_done (char *uri, void *data) free_send_data(); } - free_send_info(NULL, info, NULL); + free_send_info(info); } /* although we dont do anythign smart here yet, there is no need for this interface to |