[evolution-data-server] e_source_ref_dbus_object: Use the property lock.



commit 133c0e3fe057e6bcac5339879c08649e7cdc72b5
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Apr 27 11:18:22 2013 -0400

    e_source_ref_dbus_object: Use the property lock.
    
    ESourceRegistry is going to swap out the GDBusObject as part of the
    recovery strategy for evolution-source-registry restarts, so we need
    to make sure e_source_ref_dbus_object() is properly thread-safe.

 libedataserver/e-source.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 365974e..8853848 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -2323,12 +2323,18 @@ e_source_has_extension (ESource *source,
 GDBusObject *
 e_source_ref_dbus_object (ESource *source)
 {
+       GDBusObject *dbus_object = NULL;
+
        g_return_val_if_fail (E_IS_SOURCE (source), NULL);
 
-       if (source->priv->dbus_object == NULL)
-               return NULL;
+       g_mutex_lock (&source->priv->property_lock);
+
+       if (source->priv->dbus_object != NULL)
+               dbus_object = g_object_ref (source->priv->dbus_object);
+
+       g_mutex_unlock (&source->priv->property_lock);
 
-       return g_object_ref (source->priv->dbus_object);
+       return dbus_object;
 }
 
 /**


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