[evolution-data-server/gnome-3-24] Bug 781901 - [CamelOperation] Do not use g_cancellable_connect/disconnect()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-24] Bug 781901 - [CamelOperation] Do not use g_cancellable_connect/disconnect()
- Date: Thu, 7 Sep 2017 08:10:29 +0000 (UTC)
commit 54b74b439f77daac7340167b51c2545e2f6f72be
Author: Milan Crha <mcrha redhat com>
Date: Thu Sep 7 10:04:45 2017 +0200
Bug 781901 - [CamelOperation] Do not use g_cancellable_connect/disconnect()
src/camel/camel-operation.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/camel/camel-operation.c b/src/camel/camel-operation.c
index 7cd5d3b..bd19ad5 100644
--- a/src/camel/camel-operation.c
+++ b/src/camel/camel-operation.c
@@ -157,7 +157,9 @@ operation_finalize (GObject *object)
LOCK ();
if (priv->proxying && priv->proxying_handler_id) {
- g_cancellable_disconnect (priv->proxying, priv->proxying_handler_id);
+ /* Intentionally avoid g_cancellable_disconnect(), because it can lock
+ when the priv->proxying holds the last reference. */
+ g_signal_handler_disconnect (priv->proxying, priv->proxying_handler_id);
priv->proxying_handler_id = 0;
}
@@ -292,8 +294,14 @@ camel_operation_new_proxy (GCancellable *cancellable)
g_return_val_if_fail (priv != NULL, operation);
priv->proxying = g_object_ref (cancellable);
- priv->proxying_handler_id = g_cancellable_connect (cancellable,
- G_CALLBACK (proxying_cancellable_cancelled_cb), operation, NULL);
+ /* Intentionally avoid g_cancellable_connect(), because it can lock on call
+ of g_cancellable_disconnect() when the priv->proxying holds the last
+ reference. */
+ priv->proxying_handler_id = g_signal_connect_data (cancellable, "cancelled",
+ G_CALLBACK (proxying_cancellable_cancelled_cb), operation, NULL, 0);
+
+ if (g_cancellable_is_cancelled (cancellable))
+ proxying_cancellable_cancelled_cb (cancellable, operation);
return operation;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]