aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine/e-mail-session-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libemail-engine/e-mail-session-utils.c')
-rw-r--r--libemail-engine/e-mail-session-utils.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 7ec3ca3a70..94304cb6a9 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -576,10 +576,16 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
context->message, context->from,
context->recipients, cancellable, &error);
- if (did_connect)
+ if (did_connect) {
+ /* if the cancellable is cancelled, then the disconnect will not run,
+ thus reset it to ensure the service will be properly disconnected */
+ if (cancellable)
+ g_cancellable_reset (cancellable);
+
camel_service_disconnect_sync (
service, error == NULL,
cancellable, error ? NULL : &error);
+ }
g_object_unref (service);