[evolution-data-server] [IMAPx] Stop early in imapx_authenticate_sync() if cancelled



commit 425487905eb02506b8dc8215060bdbb6cd10b14c
Author: Milan Crha <mcrha redhat com>
Date:   Wed Aug 5 11:14:33 2015 +0200

    [IMAPx] Stop early in imapx_authenticate_sync() if cancelled

 camel/providers/imapx/camel-imapx-store.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 18572c4..132a9f8 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -824,8 +824,20 @@ imapx_authenticate_sync (CamelService *service,
 
        priv = CAMEL_IMAPX_STORE_GET_PRIVATE (service);
 
+       if (g_cancellable_set_error_if_cancelled (cancellable, error))
+               return CAMEL_AUTHENTICATION_ERROR;
+
        /* This should have been set for us by connect_sync(). */
        g_mutex_lock (&priv->server_lock);
+       if (!priv->connecting_server) {
+               g_mutex_unlock (&priv->server_lock);
+
+               g_set_error_literal (error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+                       _("No IMAPx connection object provided"));
+
+               return CAMEL_AUTHENTICATION_ERROR;
+       }
+
        imapx_server = g_object_ref (priv->connecting_server);
        g_mutex_unlock (&priv->server_lock);
 



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