[evolution-ews] Bug #675285 - Crash on deleted event move



commit a89bd0b83f27a0fb2ffdd062aa8f14c302501e96
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jul 27 13:59:29 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 38c6da6..08da878 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -167,7 +167,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;
@@ -175,11 +175,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 b8ab36c..29351a8 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -205,7 +205,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;
@@ -213,11 +213,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 9bc7922..7f3e441 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -3651,6 +3651,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 {
@@ -3780,6 +3796,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;
@@ -4793,6 +4825,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]