[gnome-online-accounts] httpclient: Split the idle handler into two parts
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] httpclient: Split the idle handler into two parts
- Date: Mon, 30 Oct 2017 16:25:08 +0000 (UTC)
commit 159a2ab7553fbacf76a4fada8b3cab01ab8944e7
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Jan 9 18:04:01 2017 +0100
httpclient: Split the idle handler into two parts
Instead of completing the GSimpleAsyncResult and freeing CheckData in
one block of code, let's split the latter into a separate function.
This will make the subsequent commit easier to read.
https://bugzilla.gnome.org/show_bug.cgi?id=764157
src/goabackend/goahttpclient.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/goabackend/goahttpclient.c b/src/goabackend/goahttpclient.c
index 4c6c6bc..c3a9f7c 100644
--- a/src/goabackend/goahttpclient.c
+++ b/src/goabackend/goahttpclient.c
@@ -69,13 +69,11 @@ typedef struct
gchar *username;
} CheckAuthData;
-static gboolean
+static void
http_client_check_data_free (gpointer user_data)
{
CheckData *data = user_data;
- g_simple_async_result_complete_in_idle (data->res);
-
if (data->cancellable_id > 0)
{
g_cancellable_disconnect (data->cancellable, data->cancellable_id);
@@ -86,8 +84,6 @@ http_client_check_data_free (gpointer user_data)
g_object_unref (data->res);
g_object_unref (data->session);
g_slice_free (CheckData, data);
-
- return G_SOURCE_REMOVE;
}
static void
@@ -141,6 +137,17 @@ http_client_check_cancelled_cb (GCancellable *cancellable, gpointer user_data)
soup_session_abort (data->session);
}
+static gboolean
+http_client_check_complete_and_free_in_idle (gpointer user_data)
+{
+ CheckData *data = user_data;
+
+ g_simple_async_result_complete_in_idle (data->res);
+ http_client_check_data_free (data);
+
+ return G_SOURCE_REMOVE;
+}
+
static void
http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
{
@@ -177,8 +184,8 @@ http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer
source = g_idle_source_new ();
g_source_set_priority (source, G_PRIORITY_DEFAULT_IDLE);
- g_source_set_callback (source, http_client_check_data_free, data, NULL);
- g_source_set_name (source, "[goa] http_client_check_data_free");
+ g_source_set_callback (source, http_client_check_complete_and_free_in_idle, data, NULL);
+ g_source_set_name (source, "[goa] http_client_check_complete_and_free_in_idle");
context = g_main_context_get_thread_default ();
g_source_attach (source, context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]