From 056325236e05cfde13f970cea775e3de6d3017e3 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 15 Aug 2013 16:14:56 -0400 Subject: [PATCH] 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 file 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); } } -- 2.7.4