[evolution-data-server] Bug #617263 - Crash of e-addressbook-factory on second start of evolution



commit de195b7b5400e0d40720bb62ef044beb5c895d5d
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 30 13:26:08 2010 +0200

    Bug #617263 - Crash of e-addressbook-factory on second start of evolution

 .../backends/google/e-book-backend-google.c        |    1 +
 addressbook/libedata-book/e-data-book-factory.c    |   18 +++++++++++++-
 calendar/libedata-cal/e-data-cal-factory.c         |   26 ++++++++++++++++----
 3 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index a5d5442..e05892b 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -1248,6 +1248,7 @@ e_book_backend_google_load_source (EBookBackend *backend, ESource *source, gbool
 	use_ssl_str = e_source_get_property (source, "ssl");
 	use_cache_str = e_source_get_property (source, "offline_sync");
 
+	refresh_interval = 3600;
 	if (refresh_interval_str && sscanf (refresh_interval_str, "%u", &refresh_interval) != 1) {
 		g_warning ("Could not parse refresh-interval!");
 		refresh_interval = 3600;
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index 88a755c..821764c 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -358,6 +358,19 @@ impl_BookFactory_getBook(EDataBookFactory *factory, const gchar *IN_source, DBus
 }
 
 static void
+remove_data_book_cb (gpointer data_bk, gpointer user_data)
+{
+	EDataBook *data_book;
+
+	data_book = E_DATA_BOOK (data_bk);
+	g_return_if_fail (data_book != NULL);
+
+	e_book_backend_remove_client (e_data_book_get_backend (data_book), data_book);
+
+	g_object_unref (data_book);
+}
+
+static void
 name_owner_changed (DBusGProxy *proxy,
                     const gchar *name,
                     const gchar *prev_owner,
@@ -369,11 +382,14 @@ name_owner_changed (DBusGProxy *proxy,
 		GList *list = NULL;
 		g_mutex_lock (factory->priv->connections_lock);
 		while (g_hash_table_lookup_extended (factory->priv->connections, prev_owner, (gpointer)&key, (gpointer)&list)) {
+			GList *copy = g_list_copy (list);
+
 			/* this should trigger the book's weak ref notify
 			 * function, which will remove it from the list before
 			 * it's freed, and will remove the connection from
 			 * priv->connections once they're all gone */
-			g_object_unref (list->data);
+			g_list_foreach (copy, remove_data_book_cb, NULL);
+			g_list_free (copy);
 		}
 
 		g_mutex_unlock (factory->priv->connections_lock);
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index e7b6b44..f3b5f99 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -443,6 +443,19 @@ impl_CalFactory_getCal (EDataCalFactory		*factory,
 }
 
 static void
+remove_data_cal_cb (gpointer data_cl, gpointer user_data)
+{
+	EDataCal *data_cal;
+
+	data_cal = E_DATA_CAL (data_cl);
+	g_return_if_fail (data_cal != NULL);
+
+	e_cal_backend_remove_client (e_data_cal_get_backend (data_cal), data_cal);
+
+	g_object_unref (data_cal);
+}
+
+static void
 name_owner_changed (DBusGProxy      *proxy,
                     const gchar      *name,
                     const gchar      *prev_owner,
@@ -453,11 +466,14 @@ name_owner_changed (DBusGProxy      *proxy,
 		gchar *key;
 		GList *list = NULL;
                 while (g_hash_table_lookup_extended (factory->priv->connections, prev_owner, (gpointer)&key, (gpointer)&list)) {
-                        /* this should trigger the book's weak ref notify
-                         * function, which will remove it from the list before
-                         * it's freed, and will remove the connection from
-                         * priv->connections once they're all gone */
-                        g_object_unref (list->data);
+			GList *copy = g_list_copy (list);
+
+			/* this should trigger the book's weak ref notify
+			 * function, which will remove it from the list before
+			 * it's freed, and will remove the connection from
+			 * priv->connections once they're all gone */
+			g_list_foreach (copy, remove_data_cal_cb, NULL);
+			g_list_free (copy);
                 }
 	}
 }



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