[evolution-ews] bug#655897 crash during autocompletion of contacts



commit 0c8987762a12dcf5e9b13f072ea3c433ec241d21
Author: Punit Jain <jpunit novell com>
Date:   Sun Aug 7 20:09:50 2011 +0530

    bug#655897 crash during autocompletion of contacts

 src/addressbook/e-book-backend-ews-gal.c   |    5 ++++-
 src/addressbook/e-book-backend-ews-utils.c |    4 +++-
 src/addressbook/e-book-backend-ews.c       |    8 ++++++--
 3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews-gal.c b/src/addressbook/e-book-backend-ews-gal.c
index 6ee1c8a..bf3a076 100644
--- a/src/addressbook/e-book-backend-ews-gal.c
+++ b/src/addressbook/e-book-backend-ews-gal.c
@@ -297,7 +297,8 @@ ews_gal_store_contact (EContact *contact, goffset offset, guint percent, gpointe
 		d(g_print ("GAL adding contacts, percent complete : %d \n", percent);)
 
 		status_message = g_strdup_printf (_("Downloading contacts in %s %d%% completed... "), priv->folder_name, percent);
-		e_data_book_view_notify_status_message (book_view, status_message);
+		if (book_view)
+			e_data_book_view_notify_status_message (book_view, status_message);
 
 		data->contact_collector = g_slist_reverse (data->contact_collector);
 		e_book_backend_sqlitedb_add_contacts (priv->ebsdb, priv->oal_id, data->contact_collector, FALSE, error);
@@ -306,6 +307,8 @@ ews_gal_store_contact (EContact *contact, goffset offset, guint percent, gpointe
 			e_book_backend_notify_update (E_BOOK_BACKEND (data->cbews), E_CONTACT (l->data));
 
 		/* reset data */
+		if (book_view)
+			e_data_book_view_unref (book_view);
 		g_free (status_message);
 		g_slist_foreach (data->contact_collector, (GFunc) g_object_unref, NULL);
 		g_slist_free (data->contact_collector);
diff --git a/src/addressbook/e-book-backend-ews-utils.c b/src/addressbook/e-book-backend-ews-utils.c
index e3aed40..6b90443 100644
--- a/src/addressbook/e-book-backend-ews-utils.c
+++ b/src/addressbook/e-book-backend-ews-utils.c
@@ -69,8 +69,10 @@ e_book_backend_ews_utils_get_book_view (EBookBackend *backend)
 	if (e_iterator_is_valid (iter)) {
 		/* just always use the first book view */
 		EDataBookView *v = (EDataBookView*)e_iterator_get (iter);
-		if (v)
+		if (v) {
 			rv = v;
+			e_data_book_view_ref (rv);
+		}
 	}
 
 	g_object_unref (iter);
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 3790917..abd5071 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -1202,8 +1202,9 @@ ebews_start_sync	(gpointer data)
 
 	status_message = g_strdup (_("Syncing contacts..."));
 	book_view = e_book_backend_ews_utils_get_book_view (E_BOOK_BACKEND (ebews));
+	if (book_view)
+		e_data_book_view_notify_status_message (book_view, status_message);
 
-	e_data_book_view_notify_status_message (book_view, status_message);
 	sync_state = e_book_backend_sqlitedb_get_sync_data (priv->ebsdb, priv->folder_id, NULL);
 	do
 	{
@@ -1244,7 +1245,10 @@ ebews_start_sync	(gpointer data)
 		e_book_backend_sqlitedb_set_sync_data (priv->ebsdb, priv->folder_id, sync_state, &error);
 	} while (!error && !includes_last_item);
 
-	e_data_book_view_notify_complete (book_view, error);
+	if (book_view) {
+		e_data_book_view_notify_complete (book_view, error);
+		e_data_book_view_unref (book_view);
+	}
 
 	if (!error)
 		e_book_backend_sqlitedb_set_is_populated (priv->ebsdb, priv->folder_id, TRUE, &error);



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