[evolution-patches] [Patch] EDS crash when committing twice a contact



try this:

...
e_book_commit_contact (book, contact, &error);
...
e_contact_set (contact, E_CONTACT_EMAIL_1, "my email com");
...
e_book_commit_contact (book, contact, &error);

the result will be that the EDS will crash.

This crash is due to the uid of the contact being NULL in the second call,
the server shouldn't crash even in this case (the patch fixes this case).

The root case of the problem is that in the do_commit_contact call in the
client side the UID is set to null with this call:

e_contact_set (contact, E_CONTACT_UID, our_op->id);

this is done supposedly to make the last operation (commit) complete and
thus emulate a sync behaviour, but this also caused the UID of the contact
to be set to NULL. (There is also a fix for this bug in the patch).

I hope the fix for this case is the rigth one, it seems to work without a
glitch.

PS: I'm not on the lists, please CC me if i have to change anything
-- 
Diego
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.210
diff -u -r1.210 ChangeLog
--- ChangeLog	14 Oct 2004 15:50:17 -0000	1.210
+++ ChangeLog	19 Oct 2004 19:27:56 -0000
@@ -1,3 +1,20 @@
+2004-10-19  Diego Gonzalez <diego pemas net>
+
+	* backends/file/e-book-backend-file.c (e_book_backend_file_modify_contact):
+	don't crash if the UID of the contact being commited is NULL.
+
+2004-10-19  Diego Gonzalez <diego pemas net>
+
+	* libebook/e-book.c (do_commit_contact): when doing a e_book_commit_contact, 
+	several times, the first time that this funcion was called with the
+	sync flag it cleared the UID of the contact, in the next operation the
+	server would crash due to the UID being null. This fixes the client side
+	and seems to work without a glitch.
+
+	I just removed the e_contact_set as it seems (from visual inspection of
+	e_contact_set) that this operation doesn't cause any call in the backend,
+	and thus it will not force the previous operation to be completed.
+
 2004-10-14  Rodney Dawes  <dobey novell com>
 
 	* backends/*/Makefile.am: Add -avoid-version to LDFLAGS for all
Index: backends/file/e-book-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/backends/file/e-book-backend-file.c,v
retrieving revision 1.22
diff -u -r1.22 e-book-backend-file.c
--- backends/file/e-book-backend-file.c	19 Aug 2004 21:19:17 -0000	1.22
+++ backends/file/e-book-backend-file.c	19 Oct 2004 19:27:57 -0000
@@ -240,6 +240,9 @@
 	*contact = e_contact_new_from_vcard (vcard);
 	id = e_contact_get(*contact, E_CONTACT_UID);
 
+	if (id == NULL)
+		return GNOME_Evolution_Addressbook_OtherError;
+
 	/* This is disgusting, but for a time cards were added with
            ID's that are no longer used (they contained both the uri
            and the id.) If we recognize it as a uri (file:///...) trim
Index: libebook/e-book.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-book.c,v
retrieving revision 1.43
diff -u -r1.43 e-book.c
--- libebook/e-book.c	30 Sep 2004 16:49:15 -0000	1.43
+++ libebook/e-book.c	19 Oct 2004 19:27:58 -0000
@@ -503,7 +503,6 @@
 		g_cond_wait (our_op->cond, our_op->mutex);
 
 		status = our_op->status;
-		e_contact_set (contact, E_CONTACT_UID, our_op->id);
 		g_free (our_op->id);
 
 		/* remove the op from the book's hash of operations */


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