[gnome-online-accounts/wip/rishi/simplify-cleanup: 2/3] ewsclient: 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: 2/3] ewsclient: Simplify the clean up
- Date: Mon, 26 Nov 2018 15:47:19 +0000 (UTC)
commit f43b69b81a7bdd26539c6f2bf4f3152c0c8d31b4
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Nov 23 18:04:33 2018 +0100
ewsclient: 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 ews_client_autodiscover_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 07f13b1d773b79e5c1049660c154b988b5ff6357.
[1] Commit 6c3e3c2d2d9f6881
https://bugzilla.gnome.org/show_bug.cgi?id=764157
src/goabackend/goaewsclient.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/src/goabackend/goaewsclient.c b/src/goabackend/goaewsclient.c
index d762d071..baf44450 100644
--- a/src/goabackend/goaewsclient.c
+++ b/src/goabackend/goaewsclient.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
@@ -79,13 +79,11 @@ typedef struct
gchar *username;
} AutodiscoverAuthData;
-static gboolean
+static void
ews_client_autodiscover_data_free (gpointer user_data)
{
AutodiscoverData *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);
@@ -97,8 +95,6 @@ ews_client_autodiscover_data_free (gpointer user_data)
g_object_unref (data->res);
g_object_unref (data->session);
g_slice_free (AutodiscoverData, data);
-
- return G_SOURCE_REMOVE;
}
static void
@@ -337,9 +333,6 @@ ews_client_autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpo
data->pending--;
if (data->pending == 0)
{
- GMainContext *context;
- GSource *source;
-
/* The result of the GAsyncResult should already be set when we
* get here. If it wasn't explicitly set to TRUE then
* autodiscovery has failed and the default value of the
@@ -347,14 +340,8 @@ ews_client_autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpo
* original caller.
*/
- source = g_idle_source_new ();
- g_source_set_priority (source, G_PRIORITY_DEFAULT_IDLE);
- g_source_set_callback (source, ews_client_autodiscover_data_free, data, NULL);
- g_source_set_name (source, "[goa] ews_client_autodiscover_data_free");
-
- context = g_main_context_get_thread_default ();
- g_source_attach (source, context);
- g_source_unref (source);
+ g_simple_async_result_complete_in_idle (data->res);
+ ews_client_autodiscover_data_free (data);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]