From 4e908c975076bfaf0b84d3285f994377f6a46a8c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 25 Mar 2013 14:20:42 +0100 Subject: [PATCH] Bug #693101 - IMAPx can vanish and redownload folder summary --- camel/camel-imapx-store.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c index 33ee30e..0161536 100644 --- a/camel/camel-imapx-store.c +++ b/camel/camel-imapx-store.c @@ -1132,11 +1132,30 @@ sync_folders (CamelIMAPXStore *istore, GHashTable *folders_from_server; gboolean notify_all; gint i, total; + GError *local_error = NULL; folders_from_server = fetch_folders_for_namespaces ( - istore, pattern, sync, cancellable, error); - if (folders_from_server == NULL) + istore, pattern, sync, cancellable, &local_error); + if (folders_from_server == NULL) { + if (local_error) + g_propagate_error (error, local_error); return FALSE; + } + + /* In certain situations can happen that the function returns data, + even either the operation was cancelled or an error was set, + thus check for this and do not update local list of folders + with incomplete data + */ + if (g_cancellable_is_cancelled (cancellable) || local_error) { + g_hash_table_foreach (folders_from_server, imapx_get_folders_free, NULL); + g_hash_table_destroy (folders_from_server); + + if (local_error) + g_propagate_error (error, local_error); + + return FALSE; + } settings = camel_service_ref_settings (CAMEL_SERVICE (istore)); notify_all = !camel_imapx_settings_get_use_subscriptions (CAMEL_IMAPX_SETTINGS (settings)); -- 2.7.4