[evolution-data-server] Use locks in factory's weak object notify callback on data-book/cal



commit 7bb751194b07b312d276c324716eefa74d7549e8
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 11 16:48:30 2012 +0200

    Use locks in factory's weak object notify callback on data-book/cal

 addressbook/libedata-book/e-data-book-factory.c |    6 ++++++
 calendar/libedata-cal/e-data-cal-factory.c      |    6 ++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index 4a1f082..bf8e67b 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -144,6 +144,9 @@ book_freed_cb (EDataBookFactory *factory,
 
 	d (g_debug ("in factory %p (%p) is dead", factory, dead));
 
+	g_mutex_lock (priv->books_lock);
+	g_mutex_lock (priv->connections_lock);
+
 	g_hash_table_foreach_remove (
 		priv->books, remove_dead_pointer_cb, dead);
 
@@ -164,6 +167,9 @@ book_freed_cb (EDataBookFactory *factory,
 		}
 	}
 
+	g_mutex_unlock (priv->connections_lock);
+	g_mutex_unlock (priv->books_lock);
+
 	e_dbus_server_release (E_DBUS_SERVER (factory));
 }
 
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index d16d7c7..a425556 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -159,6 +159,9 @@ calendar_freed_cb (EDataCalFactory *factory,
 
 	d (g_debug ("in factory %p (%p) is dead", factory, dead));
 
+	g_mutex_lock (priv->calendars_lock);
+	g_mutex_lock (priv->connections_lock);
+
 	g_hash_table_foreach_remove (
 		priv->calendars, remove_dead_calendar_cb, dead);
 
@@ -179,6 +182,9 @@ calendar_freed_cb (EDataCalFactory *factory,
 		}
 	}
 
+	g_mutex_unlock (priv->connections_lock);
+	g_mutex_unlock (priv->calendars_lock);
+
 	e_dbus_server_release (E_DBUS_SERVER (factory));
 }
 



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