[evolution-ews/gnome-3-4] Bug #675285 - Crash on deleted event move



commit 2e8e66d7d62fd358d84b040ae045899dd2dcc492
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jul 27 13:59:55 2012 +0200

    Bug #675285 - Crash on deleted event move

 src/addressbook/e-book-backend-ews.c |    6 ++--
 src/calendar/e-cal-backend-ews.c     |    6 ++--
 src/server/e-ews-connection.c        |   47 ++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 6 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 37517df..a6a29f5 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -133,7 +133,7 @@ convert_error_to_edb_error (GError **perror)
 	if ((*perror)->domain == EWS_CONNECTION_ERROR) {
 		switch ((*perror)->code) {
 		case EWS_CONNECTION_ERROR_AUTHENTICATION_FAILED:
-			error = EDB_ERROR (AUTHENTICATION_FAILED);
+			error = EDB_ERROR_EX (AUTHENTICATION_FAILED, (*perror)->message);
 			break;
 		case EWS_CONNECTION_ERROR_CANCELLED:
 			break;
@@ -141,11 +141,11 @@ convert_error_to_edb_error (GError **perror)
 		case EWS_CONNECTION_ERROR_MANAGEDFOLDERNOTFOUND:
 		case EWS_CONNECTION_ERROR_PARENTFOLDERNOTFOUND:
 		case EWS_CONNECTION_ERROR_PUBLICFOLDERSERVERNOTFOUND:
-			error = EDB_ERROR (NO_SUCH_BOOK);
+			error = EDB_ERROR_EX (NO_SUCH_BOOK, (*perror)->message);
 			break;
 		case EWS_CONNECTION_ERROR_EVENTNOTFOUND:
 		case EWS_CONNECTION_ERROR_ITEMNOTFOUND:
-			error = EDB_ERROR (CONTACT_NOT_FOUND);
+			error = EDB_ERROR_EX (CONTACT_NOT_FOUND, (*perror)->message);
 			break;
 		}
 	}
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 42af8e5..3e138a7 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -135,7 +135,7 @@ convert_error_to_edc_error (GError **perror)
 	if ((*perror)->domain == EWS_CONNECTION_ERROR) {
 		switch ((*perror)->code) {
 		case EWS_CONNECTION_ERROR_AUTHENTICATION_FAILED:
-			error = EDC_ERROR (AuthenticationFailed);
+			error = EDC_ERROR_EX (AuthenticationFailed, (*perror)->message);
 			break;
 		case EWS_CONNECTION_ERROR_CANCELLED:
 			break;
@@ -143,11 +143,11 @@ convert_error_to_edc_error (GError **perror)
 		case EWS_CONNECTION_ERROR_MANAGEDFOLDERNOTFOUND:
 		case EWS_CONNECTION_ERROR_PARENTFOLDERNOTFOUND:
 		case EWS_CONNECTION_ERROR_PUBLICFOLDERSERVERNOTFOUND:
-			error = EDC_ERROR (NoSuchCal);
+			error = EDC_ERROR_EX (NoSuchCal, (*perror)->message);
 			break;
 		case EWS_CONNECTION_ERROR_EVENTNOTFOUND:
 		case EWS_CONNECTION_ERROR_ITEMNOTFOUND:
-			error = EDC_ERROR (ObjectNotFound);
+			error = EDC_ERROR_EX (ObjectNotFound, (*perror)->message);
 			break;
 		}
 	}
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index aab5a29..deff135 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -3259,6 +3259,22 @@ e_ews_connection_update_items_finish (EEwsConnection *cnc,
 
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
+
+	/* if there is only one item, then check whether it's an error */
+	if (async_data->items && !async_data->items->next) {
+		EEwsItem *item = async_data->items->data;
+
+		if (item && e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			if (error)
+				*error = g_error_copy (e_ews_item_get_error (item));
+
+			g_slist_free_full (async_data->items, g_object_unref);
+			async_data->items = NULL;
+
+			return FALSE;
+		}
+	}
+
 	if (ids)
 		*ids = async_data->items;
 	else {
@@ -3382,6 +3398,22 @@ e_ews_connection_create_items_finish (EEwsConnection *cnc,
 
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
+
+	/* if there is only one item, then check whether it's an error */
+	if (async_data->items && !async_data->items->next) {
+		EEwsItem *item = async_data->items->data;
+
+		if (item && e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			if (error)
+				*error = g_error_copy (e_ews_item_get_error (item));
+
+			g_slist_free_full (async_data->items, g_object_unref);
+			async_data->items = NULL;
+
+			return FALSE;
+		}
+	}
+
 	*ids = async_data->items;
 
 	return TRUE;
@@ -4290,6 +4322,21 @@ e_ews_connection_move_items_finish (EEwsConnection *cnc,
 	if (g_simple_async_result_propagate_error (simple, error))
 		return FALSE;
 
+	/* if there is only one item, then check whether it's an error */
+	if (async_data->items && !async_data->items->next) {
+		EEwsItem *item = async_data->items->data;
+
+		if (item && e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			if (error)
+				*error = g_error_copy (e_ews_item_get_error (item));
+
+			g_slist_free_full (async_data->items, g_object_unref);
+			async_data->items = NULL;
+
+			return FALSE;
+		}
+	}
+
 	*items = async_data->items;
 
 	return TRUE;



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