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



commit 91efce25a85699c69fa3348cfca5459f57124375
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Aug 15 16:24:52 2013 -0400

    EDataCalFactory: 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

 calendar/libedata-cal/e-data-cal-factory.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index c4bca54..61e7514 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -181,12 +181,20 @@ data_cal_factory_name_vanished_cb (GDBusConnection *connection,
        factory = g_weak_ref_get (weak_ref);
 
        if (factory != NULL) {
+               data_cal_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_cal_factory_connections_remove (factory, name, NULL);
-
                g_object_unref (factory);
        }
 }


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