[evolution-data-server/gnome-3-8] e_source_ref_dbus_object: Use the property lock.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-8] e_source_ref_dbus_object: Use the property lock.
- Date: Thu, 2 May 2013 12:56:29 +0000 (UTC)
commit babff909fb378cc1b3022bd3ad2046a4825912f1
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.
(cherry picked from commit 133c0e3fe057e6bcac5339879c08649e7cdc72b5)
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 251c3a1..ae9d3dd 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -2324,12 +2324,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]