[evolution-patches] Exchange: Fix for the bug 273470



Hello -

The attached patch fixes the bug 273470 that caused missing out of some
contacts when copying multiple contacts from local to the Exchange
addressbook. Please review.

Thanks -
Praveen.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.379
diff -u -p -r1.379 ChangeLog
--- ChangeLog	18 Aug 2005 04:31:54 -0000	1.379
+++ ChangeLog	18 Aug 2005 09:09:17 -0000
@@ -1,3 +1,12 @@
+2005-08-18  Praveen Kumar  <kpraveen novell com>
+
+	** Fixes bug 273470
+	
+	* addressbook/e-book-backend-exchange.c
+	(e_book_backend_exchange_create_contact): Providing mutex for this
+	function in critical path so that it works seemless when invoked 
+	as a thread.
+
 2005-08-17  Not Zed  <NotZed Ximian com>
 
 	** See bug #312668.
Index: addressbook/e-book-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/addressbook/e-book-backend-exchange.c,v
retrieving revision 1.37
diff -u -p -r1.37 e-book-backend-exchange.c
--- addressbook/e-book-backend-exchange.c	17 Aug 2005 10:43:59 -0000	1.37
+++ addressbook/e-book-backend-exchange.c	18 Aug 2005 09:09:19 -0000
@@ -1280,13 +1280,21 @@ e_book_backend_exchange_create_contact (
 	E2kHTTPStatus status;
 	char *location = NULL, *note;
 	EContactPhoto *photo;
+	static GMutex *mutex = NULL;
 
 	d(printf("ebbe_create_contact(%p, %p, %s)\n", backend, book, vcard));
 
+	if (!mutex) {
+		mutex = g_mutex_new ();
+	}
+
+	g_mutex_lock (mutex);
+
 	switch (bepriv->mode) {
 
 	case GNOME_Evolution_Addressbook_MODE_LOCAL:
 		*contact = NULL;
+		g_mutex_unlock (mutex);
 		return GNOME_Evolution_Addressbook_RepositoryOffline;
 	
 	case GNOME_Evolution_Addressbook_MODE_REMOTE:	
@@ -1326,15 +1334,18 @@ e_book_backend_exchange_create_contact (
 			e_book_backend_summary_add_contact (bepriv->summary,
 							    *contact);
 			e_book_backend_cache_add_contact (bepriv->cache, *contact);
+			g_mutex_unlock (mutex);
 			return GNOME_Evolution_Addressbook_Success;
 		} else {
 			g_object_unref (*contact);
 			*contact = NULL;
+			g_mutex_unlock (mutex);
 			return http_status_to_pas (status);
 		}
 	default:
 		break;
 	}
+	g_mutex_unlock (mutex);
 	return GNOME_Evolution_Addressbook_Success;
 }
 


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