From: Milan Crha Date: Thu, 2 Sep 2010 12:02:48 +0000 (+0200) Subject: Bug #625110 - IMAPX : Do not free connection manager on disconnect X-Git-Tag: upstream/3.7.4~2669 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e65979b27a1ae8f97967d83041e33e62c2bb10b3;p=platform%2Fupstream%2Fevolution-data-server.git Bug #625110 - IMAPX : Do not free connection manager on disconnect --- diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c index c3f80d6..c0d3b4a 100644 --- a/camel/providers/imapx/camel-imapx-folder.c +++ b/camel/providers/imapx/camel-imapx-folder.c @@ -158,8 +158,13 @@ imapx_refresh_info (CamelFolder *folder, GError **error) parent_store = camel_folder_get_parent_store (folder); istore = CAMEL_IMAPX_STORE (parent_store); - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) - return TRUE; + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); + return FALSE; + } if (!camel_service_connect((CamelService *)istore, error)) return FALSE; @@ -184,8 +189,13 @@ imapx_expunge (CamelFolder *folder, GError **error) parent_store = camel_folder_get_parent_store (folder); istore = CAMEL_IMAPX_STORE (parent_store); - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) - return TRUE; + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); + return FALSE; + } server = camel_imapx_store_get_server(istore, camel_folder_get_full_name (folder), error); if (server) { @@ -208,8 +218,13 @@ imapx_sync (CamelFolder *folder, gboolean expunge, GError **error) parent_store = camel_folder_get_parent_store (folder); istore = CAMEL_IMAPX_STORE (parent_store); - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) - return TRUE; + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); + return FALSE; + } server = camel_imapx_store_get_server(istore, camel_folder_get_full_name (folder), NULL); if (server) @@ -260,8 +275,13 @@ imapx_get_message (CamelFolder *folder, const gchar *uid, GError **error) return NULL; } - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); return NULL; + } server = camel_imapx_store_get_server(istore, camel_folder_get_full_name (folder), error); if (server) { @@ -298,8 +318,13 @@ imapx_sync_message (CamelFolder *folder, const gchar *uid, GError **error) parent_store = camel_folder_get_parent_store (folder); istore = CAMEL_IMAPX_STORE (parent_store); - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) - return TRUE; + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); + return FALSE; + } server = camel_imapx_store_get_server (istore, camel_folder_get_full_name (folder), error); if (server == NULL) @@ -325,8 +350,13 @@ imapx_transfer_messages_to (CamelFolder *source, GPtrArray *uids, parent_store = camel_folder_get_parent_store (source); istore = CAMEL_IMAPX_STORE (parent_store); - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) - return TRUE; + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); + return FALSE; + } server = camel_imapx_store_get_server (istore, camel_folder_get_full_name (source), error); if (server) { @@ -351,8 +381,13 @@ imapx_append_message(CamelFolder *folder, CamelMimeMessage *message, const Camel parent_store = camel_folder_get_parent_store (folder); istore = CAMEL_IMAPX_STORE (parent_store); - if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) - return TRUE; + if (CAMEL_OFFLINE_STORE (istore)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) { + g_set_error ( + error, CAMEL_SERVICE_ERROR, + CAMEL_SERVICE_ERROR_UNAVAILABLE, + _("You must be working online to complete this operation")); + return FALSE; + } if (appended_uid) *appended_uid = NULL; diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c index b7ef310..ebdbb23 100644 --- a/camel/providers/imapx/camel-imapx-store.c +++ b/camel/providers/imapx/camel-imapx-store.c @@ -128,6 +128,10 @@ imapx_store_finalize (GObject *object) /* SIGH */ camel_service_disconnect((CamelService *)imapx_store, TRUE, NULL); + if (imapx_store->con_man) { + g_object_unref (imapx_store->con_man); + imapx_store->con_man = NULL; + } g_mutex_free (imapx_store->get_finfo_lock); g_free (imapx_store->base_url); @@ -274,8 +278,6 @@ imapx_disconnect (CamelService *service, gboolean clean, GError **error) if (istore->con_man) { camel_imapx_conn_manager_close_connections (istore->con_man); - g_object_unref (istore->con_man); - istore->con_man = NULL; } camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);