[evolution-data-server] ECalClient: Use G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED for close().



commit 2535427ac2fc516b0caa2ff4d4ef1340484adf05
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Apr 2 10:25:50 2013 -0400

    ECalClient: Use G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED for close().
    
    Invoke the close() method without a callback function so the server
    knows not to reply.  ECalClient tests that use GTestDBus generally
    close their GDBusConnection immediately after disposing ECalClient,
    and because we call close() asynchronously the server sometimes has
    no chance to reply before the GDBusConnection closes, resulting in
    a spurious console warning during the test.

 calendar/libecal/e-cal-client.c    |   24 ++++--------------------
 calendar/libedata-cal/e-data-cal.c |    5 +++++
 2 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 95ce2da..9bef374 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -719,22 +719,6 @@ cal_client_name_vanished_cb (GDBusConnection *connection,
 }
 
 static void
-cal_client_close_cb (GObject *source_object,
-                     GAsyncResult *result,
-                     gpointer user_data)
-{
-       GError *error = NULL;
-
-       e_dbus_calendar_call_close_finish (
-               E_DBUS_CALENDAR (source_object), result, &error);
-
-       if (error != NULL) {
-               g_warning ("%s: %s", G_STRFUNC, error->message);
-               g_error_free (error);
-       }
-}
-
-static void
 cal_client_set_source_type (ECalClient *cal_client,
                             ECalClientSourceType source_type)
 {
@@ -818,11 +802,11 @@ cal_client_dispose (GObject *object)
        }
 
        if (priv->dbus_proxy != NULL) {
-               /* Call close() asynchronously
-                * so we don't block dispose(). */
+               /* Call close() asynchronously so we don't block dispose().
+                * Also omit a callback function, so the GDBusMessage uses
+                * G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED. */
                e_dbus_calendar_call_close (
-                       priv->dbus_proxy, NULL,
-                       cal_client_close_cb, NULL);
+                       priv->dbus_proxy, NULL, NULL, NULL);
                g_object_unref (priv->dbus_proxy);
                priv->dbus_proxy = NULL;
        }
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index a6e277f..ab3fea0 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -1459,6 +1459,11 @@ data_cal_handle_close_cb (EDBusCalendar *interface,
        ECalBackend *backend;
        const gchar *sender;
 
+       /* G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED should be set on
+        * the GDBusMessage, but we complete the invocation anyway
+        * and let the D-Bus machinery suppress the reply. */
+       e_dbus_calendar_complete_close (interface, invocation);
+
        backend = e_data_cal_ref_backend (data_cal);
        g_return_val_if_fail (backend != NULL, FALSE);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]