[evolution-patches] Address book: Patch for #273716



The status was not set for asynchronous operation, in 
e_book_response_add_contact(), so the contact creation was
assumed to be successful and contact being moved was 
deleted form the source book.

Found similar problem in other places too.

Please review,
Sushma.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.261
diff -u -p -r1.261 ChangeLog
--- ChangeLog	11 Apr 2005 12:21:26 -0000	1.261
+++ ChangeLog	27 Apr 2005 08:04:15 -0000
@@ -1,3 +1,16 @@
+2005-04-27  Sushma Rai  <rsushma novell com>
+
+	* libebook/e-book.c (e_book_response_add_contact): Setting the status
+	for both synchronous and asynchronous operations.
+	(e_book_response_get_required_fields): Similar.
+	(e_book_response_get_supported_fields): Similar.
+	(e_book_response_get_supported_auth_method): Similar.
+	(e_book_response_get_contacts): Setting the status outside the 
+	operation type condition check.
+	(e_book_response_generic): Similar.
+	(e_book_response_open): Similar.
+	(e_book_response_remove): Similar.
+	
 2005-04-11  Harish Krishnaswamy  <kharish novell com>
 
 	* libebook/Makefile.am, libedata-book/Makefile.am:
Index: libebook/e-book.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-book.c,v
retrieving revision 1.50
diff -u -p -r1.50 e-book.c
--- libebook/e-book.c	2 Feb 2005 18:44:29 -0000	1.50
+++ libebook/e-book.c	27 Apr 2005 08:04:36 -0000
@@ -401,12 +401,11 @@ e_book_response_add_contact (EBook      
 	}
 
 	op->id = g_strdup (id);
+	op->status = status;
 
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
-
 		g_cond_signal (op->cond);
 
 		g_mutex_unlock (op->mutex);
@@ -848,10 +847,10 @@ e_book_response_get_required_fields (EBo
 		return;
 	}
 
+	op->status = status;
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
 		op->list = fields;
 
 		g_cond_signal (op->cond);
@@ -898,10 +897,10 @@ e_book_response_get_supported_fields (EB
 		return;
 	}
 
+	op->status = status;
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
 		op->list = fields;
 
 		g_cond_signal (op->cond);
@@ -1077,10 +1076,10 @@ e_book_response_get_supported_auth_metho
 		return;
 	}
 
+	op->status = status;
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
 		op->list = auth_methods;
 
 		g_cond_signal (op->cond);
@@ -2073,19 +2072,17 @@ e_book_response_get_contacts (EBook     
 
 	op->list = g_list_copy (contact_list);
 	g_list_foreach (op->list, (GFunc)g_object_ref, NULL);
+	op->status = status;
 
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
-
 		g_cond_signal (op->cond);
 
 		g_mutex_unlock (op->mutex);
 	}
 	else {
 		op->book = g_object_ref (book);
-		op->status = status;
 		op->idle_id = g_idle_add (emit_async_get_contacts_response, op);
 		book->priv->pending_idles = g_list_prepend (book->priv->pending_idles,
 							    GINT_TO_POINTER (op->idle_id));
@@ -2334,18 +2331,16 @@ e_book_response_generic (EBook       *bo
 		return;
 	}
 
+	op->status = status;
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
-
 		g_cond_signal (op->cond);
 
 		g_mutex_unlock (op->mutex);
 	}
 	else {
 		op->book = g_object_ref (book);
-		op->status = status;
 		op->idle_id = g_idle_add (emit_async_generic_response, op);
 		book->priv->pending_idles = g_list_prepend (book->priv->pending_idles,
 							    GINT_TO_POINTER (op->idle_id));
@@ -2624,18 +2619,16 @@ e_book_response_open (EBook       *book,
 		return;
 	}
 
+	op->status = status;
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
-
 		g_cond_signal (op->cond);
 
 		g_mutex_unlock (op->mutex);
 	}
 	else {
 		op->book = g_object_ref (book);
-		op->status = status;
 		op->idle_id = g_idle_add (emit_async_open_response, op);
 		book->priv->pending_idles = g_list_prepend (book->priv->pending_idles,
 							    GINT_TO_POINTER (op->idle_id));
@@ -2774,18 +2767,16 @@ e_book_response_remove (EBook       *boo
 		return;
 	}
 
+	op->status = status;
 	if (op->synchronous) {
 		g_mutex_lock (op->mutex);
 
-		op->status = status;
-
 		g_cond_signal (op->cond);
 
 		g_mutex_unlock (op->mutex);
 	}
 	else {
 		op->book = g_object_ref (book);
-		op->status = status;
 		op->idle_id = g_idle_add (emit_async_generic_response, op);
 		book->priv->pending_idles = g_list_prepend (book->priv->pending_idles,
 							    GINT_TO_POINTER (op->idle_id));


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