[gnome-online-accounts/wip/rishi/simplify-cleanup: 1/2] httpclient: Simplify the clean up
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/simplify-cleanup: 1/2] httpclient: Simplify the clean up
- Date: Fri, 23 Nov 2018 19:41:51 +0000 (UTC)
commit 9a03fe3800e34dfde5162fa9f387be5642ac548e
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Nov 23 20:14:07 2018 +0100
httpclient: Simplify the clean up
Now that the deprecated SoupSessionAsync has been replaced with
SoupSession [1], the response callbacks are invoked in the next
iteration of the main loop after soup_session_abort has returned. This
means that http_client_check_response_cb is no longer called from a
GCancellable::cancelled signal handler. Therefore, it's safe to
directly disconnect from the GCancellable in the response callback
without fearing for any deadlocks.
This reverts commit b2f94098829232bcb8294d5cefee85d5b9368f2d.
[1] Commit 6c3e3c2d2d9f6881
src/goabackend/goahttpclient.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/src/goabackend/goahttpclient.c b/src/goabackend/goahttpclient.c
index e340708c..c1cbc044 100644
--- a/src/goabackend/goahttpclient.c
+++ b/src/goabackend/goahttpclient.c
@@ -1,6 +1,6 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
- * Copyright © 2012 – 2017 Red Hat, Inc.
+ * Copyright © 2012 – 2018 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -145,21 +145,10 @@ http_client_check_cancelled_cb (GCancellable *cancellable, gpointer user_data)
g_return_if_fail (cancelled);
}
-static gboolean
-http_client_check_free_in_idle (gpointer user_data)
-{
- GTask *task = G_TASK (user_data);
-
- g_object_unref (task);
- return G_SOURCE_REMOVE;
-}
-
static void
http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
{
GError *error;
- GMainContext *context;
- GSource *source;
GTask *task = G_TASK (user_data);
error = NULL;
@@ -181,22 +170,7 @@ http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer
g_task_return_boolean (task, TRUE);
out:
- /* We might be invoked from a GCancellable::cancelled
- * handler, and unreffing the GTask will disconnect the
- * handler. Since disconnecting from inside the handler will cause a
- * deadlock [1], we use an idle handler to break them up.
- *
- * [1] https://bugzilla.gnome.org/show_bug.cgi?id=705395
- */
-
- source = g_idle_source_new ();
- g_source_set_priority (source, G_PRIORITY_DEFAULT_IDLE);
- g_source_set_callback (source, http_client_check_free_in_idle, task, NULL);
- g_source_set_name (source, "[goa] http_client_check_free_in_idle");
-
- context = g_task_get_context (task);
- g_source_attach (source, context);
- g_source_unref (source);
+ g_object_unref (task);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]