[evolution-data-server] [CamelService] Connect/Disconnect rely on provided cancellable
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] [CamelService] Connect/Disconnect rely on provided cancellable
- Date: Fri, 24 Oct 2014 09:11:57 +0000 (UTC)
commit 9d5a89eae5ebaaa833e739cfb605898698f6d7f3
Author: Milan Crha <mcrha redhat com>
Date: Fri Oct 24 11:09:32 2014 +0200
[CamelService] Connect/Disconnect rely on provided cancellable
To properly react on Connect and Disconnect requests the cancellable
for these should be provided, because the code relies on it and uses
it to eventually cancel any pending connect or disconnect, but
the cancellable is an optional parameter, thus always create one
if necessary.
camel/camel-service.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-service.c b/camel/camel-service.c
index dfa0d3e..3cd9935 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -1806,6 +1806,11 @@ camel_service_connect (CamelService *service,
g_return_if_fail (CAMEL_IS_SERVICE (service));
+ if (cancellable)
+ g_object_ref (cancellable);
+ else
+ cancellable = g_cancellable_new ();
+
task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, camel_service_connect);
g_task_set_priority (task, io_priority);
@@ -1861,6 +1866,7 @@ camel_service_connect (CamelService *service,
g_mutex_unlock (&service->priv->connection_lock);
+ g_object_unref (cancellable);
g_object_unref (task);
}
@@ -1972,6 +1978,11 @@ camel_service_disconnect (CamelService *service,
g_return_if_fail (CAMEL_IS_SERVICE (service));
+ if (cancellable)
+ g_object_ref (cancellable);
+ else
+ cancellable = g_cancellable_new ();
+
task = g_task_new (service, cancellable, callback, user_data);
g_task_set_source_tag (task, camel_service_disconnect);
g_task_set_priority (task, io_priority);
@@ -2035,6 +2046,7 @@ camel_service_disconnect (CamelService *service,
g_mutex_unlock (&service->priv->connection_lock);
+ g_object_unref (cancellable);
g_object_unref (task);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]