[evolution-data-server] EDataBookFactory: Work around a GDBus name watching bug.



commit 056325236e05cfde13f970cea775e3de6d3017e3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Aug 15 16:14:56 2013 -0400

    EDataBookFactory: Work around a GDBus name watching bug.
    
    Calling g_bus_unwatch_name() from a GBusNameVanished callback will
    corrupt the function arguments.  Work around this GDBus bug [1] by
    unwatching the bus name last in the callback.
    
    [1] https://bugzilla.gnome.org/706088

 addressbook/libedata-book/e-data-book-factory.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index 1e1b2ec..19a32d5 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -175,12 +175,20 @@ data_book_factory_name_vanished_cb (GDBusConnection *connection,
        factory = g_weak_ref_get (weak_ref);
 
        if (factory != NULL) {
+               data_book_factory_connections_remove (factory, name, NULL);
+
+               /* Unwatching the bus name from here will corrupt the
+                * 'name' argument, and possibly also the 'user_data'.
+                *
+                * This is a GDBus bug.  Work around it by unwatching
+                * the bus name last.
+                *
+                * See: https://bugzilla.gnome.org/706088
+                */
                g_mutex_lock (&factory->priv->watched_names_lock);
                g_hash_table_remove (factory->priv->watched_names, name);
                g_mutex_unlock (&factory->priv->watched_names_lock);
 
-               data_book_factory_connections_remove (factory, name, NULL);
-
                g_object_unref (factory);
        }
 }


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