[evolution-data-server] libebook: Don’t emit a wa rning on a dropped D-Bus connection in dispose

commit e31aae9c123da33a5613fa77cba55668e356f9ce
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Apr 7 22:22:12 2014 +0100

    libebook: Don’t emit a warning on a dropped D-Bus connection in dispose
    This occasionally and unavoidably happens in the libfolks unit tests,
    where libfolks drops its final EBookClientView reference and proceeds to
    kill the dbus-daemon. EBookClientView, however, keeps itself alive
    internally in order to send a dispose() method call to the address book
    server. This method call can return after the server has been killed,
    and will return a G_IO_ERROR_CLOSED error in such cases. Ignore them.

 addressbook/libebook/e-book-client-view.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/addressbook/libebook/e-book-client-view.c b/addressbook/libebook/e-book-client-view.c
index ed8e67b..6212588 100644
--- a/addressbook/libebook/e-book-client-view.c
+++ b/addressbook/libebook/e-book-client-view.c
@@ -677,11 +677,17 @@ book_client_view_dispose_cb (GObject *source_object,
        e_gdbus_book_view_call_dispose_finish (
                G_DBUS_PROXY (source_object), result, &local_error);
-       if (local_error != NULL) {
+       /* Ignore closed errors, since this callback can be called after the
+        * EBookClientView has been disposed, and hence after the calling code
+        * has dropped its final reference and gone on to clean up other things
+        * (like the dbus-daemon, if it’s a test harness). */
+       if (local_error != NULL &&
+           !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CLOSED)) {
                g_dbus_error_strip_remote_error (local_error);
                g_warning ("%s: %s", G_STRFUNC, local_error->message);
-               g_error_free (local_error);
+       g_clear_error (&local_error);
 static void

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