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



commit c9a29823124717b649c6013268ff904152240a57
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Apr 2 09:53:08 2013 -0400

    EBookClient: 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.  EBookClient tests that use GTestDBus generally
    close their GDBusConnection immediately after disposing EBookClient,
    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.

 addressbook/libebook/e-book-client.c    |   24 ++++--------------------
 addressbook/libedata-book/e-data-book.c |    3 +++
 2 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index feab850..2c0ef10 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -600,22 +600,6 @@ book_client_name_vanished_cb (GDBusConnection *connection,
 }
 
 static void
-book_client_close_cb (GObject *source_object,
-                      GAsyncResult *result,
-                      gpointer user_data)
-{
-       GError *error = NULL;
-
-       e_dbus_address_book_call_close_finish (
-               E_DBUS_ADDRESS_BOOK (source_object), result, &error);
-
-       if (error != NULL) {
-               g_warning ("%s: %s", G_STRFUNC, error->message);
-               g_error_free (error);
-       }
-}
-
-static void
 book_client_dispose (GObject *object)
 {
        EBookClientPrivate *priv;
@@ -637,11 +621,11 @@ book_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_address_book_call_close (
-                       priv->dbus_proxy, NULL,
-                       book_client_close_cb, NULL);
+                       priv->dbus_proxy, NULL, NULL, NULL);
                g_object_unref (priv->dbus_proxy);
                priv->dbus_proxy = NULL;
        }
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 7946bc8..565cdb3 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -1035,6 +1035,9 @@ data_book_handle_close_cb (EDBusAddressBook *interface,
        EBookBackend *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_address_book_complete_close (interface, invocation);
 
        backend = e_data_book_ref_backend (data_book);


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