summaryrefslogtreecommitdiff
path: root/camel/providers/pop3/camel-pop3-store.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/pop3/camel-pop3-store.c')
-rw-r--r--camel/providers/pop3/camel-pop3-store.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 25dd1ae10..42744c0e6 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -610,12 +610,15 @@ pop3_store_disconnect_sync (CamelService *service,
pop3_engine = camel_pop3_store_ref_engine (store);
if (pop3_engine) {
- pc = camel_pop3_engine_command_new (
- pop3_engine, 0, NULL, NULL,
- cancellable, error, "QUIT\r\n");
- while (camel_pop3_engine_iterate (pop3_engine, NULL, cancellable, NULL) > 0)
- ;
- camel_pop3_engine_command_free (pop3_engine, pc);
+ if (camel_pop3_engine_busy_lock (pop3_engine, cancellable, NULL)) {
+ pc = camel_pop3_engine_command_new (
+ pop3_engine, 0, NULL, NULL,
+ cancellable, error, "QUIT\r\n");
+ while (camel_pop3_engine_iterate (pop3_engine, NULL, cancellable, NULL) > 0)
+ ;
+ camel_pop3_engine_command_free (pop3_engine, pc);
+ camel_pop3_engine_busy_unlock (pop3_engine);
+ }
g_clear_object (&pop3_engine);
}
@@ -671,6 +674,14 @@ pop3_store_authenticate_sync (CamelService *service,
goto exit;
}
+ if (!camel_pop3_engine_busy_lock (pop3_engine, cancellable, error)) {
+ g_free (host);
+ g_free (user);
+ g_clear_object (&pop3_engine);
+
+ return CAMEL_AUTHENTICATION_ERROR;
+ }
+
if (mechanism == NULL) {
if (password == NULL) {
g_set_error_literal (
@@ -820,6 +831,7 @@ exit:
g_free (host);
g_free (user);
+ camel_pop3_engine_busy_unlock (pop3_engine);
g_clear_object (&pop3_engine);
return result;
@@ -1094,6 +1106,11 @@ camel_pop3_store_expunge (CamelPOP3Store *store,
pop3_engine = camel_pop3_store_ref_engine (store);
+ if (!camel_pop3_engine_busy_lock (pop3_engine, cancellable, error)) {
+ g_clear_object (&pop3_engine);
+ return FALSE;
+ }
+
pc = camel_pop3_engine_command_new (
pop3_engine, 0, NULL, NULL, cancellable, error, "QUIT\r\n");
@@ -1102,6 +1119,7 @@ camel_pop3_store_expunge (CamelPOP3Store *store,
camel_pop3_engine_command_free (pop3_engine, pc);
+ camel_pop3_engine_busy_unlock (pop3_engine);
g_clear_object (&pop3_engine);
return TRUE;