aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/camel-service.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/camel/camel-service.c b/camel/camel-service.c
index fed8945008..befc8d4f69 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -230,6 +230,7 @@ gboolean
camel_service_connect (CamelService *service, CamelException *ex)
{
gboolean ret = FALSE;
+ gboolean unreg = FALSE;
g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
g_return_val_if_fail (service->session != NULL, FALSE);
@@ -250,6 +251,7 @@ camel_service_connect (CamelService *service, CamelException *ex)
if (!service->connect_op) {
service->connect_op = camel_operation_new (NULL, NULL);
camel_operation_register (service->connect_op);
+ unreg = TRUE;
}
CAMEL_SERVICE_UNLOCK (service, connect_op_lock);
@@ -258,6 +260,8 @@ camel_service_connect (CamelService *service, CamelException *ex)
service->status = ret ? CAMEL_SERVICE_CONNECTED : CAMEL_SERVICE_DISCONNECTED;
CAMEL_SERVICE_LOCK (service, connect_op_lock);
+ if (unreg)
+ camel_operation_unregister (service->connect_op);
camel_operation_unref (service->connect_op);
service->connect_op = NULL;
CAMEL_SERVICE_UNLOCK (service, connect_op_lock);