[evolution-data-server/gnome-3-8] Bug #693101 - IMAPx can vanish and redownload folder summary



commit 7a52e0c602ee3356e4a0c716b9f35b9985f81e03
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 25 14:21:42 2013 +0100

    Bug #693101 - IMAPx can vanish and redownload folder summary

 camel/camel-imapx-store.c |   23 +++++++++++++++++++++--
 1 files 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));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]