[evolution-patches] [addressbook] Patch for a crash in creating contact lists



Hi

Evolution was crashing when a duplicate contact-list was created which
contained a contact with no email-ids specified. The crash was happening
because of passing the null email-id to the rendering code.
Added a check so that a contact with no email-ids specified can't be
added to a contact-list.

Regards
Devashish Sharma
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1991
diff -u -p -r1.1991 ChangeLog
--- addressbook/ChangeLog	14 Sep 2005 10:27:07 -0000	1.1991
+++ addressbook/ChangeLog	26 Sep 2005 09:38:33 -0000
@@ -1,3 +1,16 @@
+2005-09-26  Devashish Sharma <sdevashish novell com>
+
+	* gui/contact-list-editor/e-contact-list-editor.c
+	(table_drag_data_received_cb): Added a check that the contact received
+	through drag contains an email-id. There is no point in adding a
+	contact to the contact-list if the contact has no email-id. This
+	was causing a crash also.
+
+	* gui/widgets/eab-contact-display.c
+	(eab_contact_display_render_compact): Added a check for catching null
+	email-ids, in case of contact-lists, so that null ids are not passed
+	for rendering, which was causing a crash. 
+
 2005-09-14  Sushma Rai  <rsushma novell com>
 
 	* gui/contact-list-editor/e-contact-list-editor.etspec: Set selection 
Index: addressbook/gui/contact-list-editor/e-contact-list-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-list-editor/e-contact-list-editor.c,v
retrieving revision 1.72
diff -u -p -r1.72 e-contact-list-editor.c
--- addressbook/gui/contact-list-editor/e-contact-list-editor.c	24 Aug 2005 03:06:51 -0000	1.72
+++ addressbook/gui/contact-list-editor/e-contact-list-editor.c	26 Sep 2005 09:44:58 -0000
@@ -960,12 +960,16 @@ table_drag_data_received_cb (ETable *tab
 		for (c = contact_list; c; c = c->next) {
 			EContact *contact = c->data;
 
-			if (!e_contact_get (contact, E_CONTACT_IS_LIST)) {
-				e_contact_list_model_add_contact (E_CONTACT_LIST_MODEL (editor->model),
-								  contact,
-								  0  /* Hard-wired for default e-mail */);
-
-				changed = TRUE;
+			if (!e_contact_get (contact, E_CONTACT_IS_LIST)) { 
+				if (e_contact_get (contact, E_CONTACT_EMAIL)) {
+					e_contact_list_model_add_contact (E_CONTACT_LIST_MODEL (editor->model),
+									  contact,
+									  0  /* Hard-wired for default e-mail */);
+		
+					changed = TRUE;
+				}
+				else
+					g_warning ("Contact with no email-ids listed can't be added to a Contact-List");
 			}
 		}
 		g_list_foreach (contact_list, (GFunc)g_object_unref, NULL);
Index: addressbook/gui/widgets/eab-contact-display.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-contact-display.c,v
retrieving revision 1.23
diff -u -p -r1.23 eab-contact-display.c
--- addressbook/gui/widgets/eab-contact-display.c	24 Aug 2005 03:06:51 -0000	1.23
+++ addressbook/gui/widgets/eab-contact-display.c	26 Sep 2005 10:19:45 -0000
@@ -545,10 +545,13 @@ eab_contact_display_render_compact (EABC
 			gtk_html_stream_printf (html_stream, "<b>%s:</b>&nbsp;<td>", _("List Members"));
 
 			email_list = e_contact_get (contact, E_CONTACT_EMAIL);
+
 			for (l = email_list; l; l = l->next) {
-				char *html = e_text_to_html (l->data, 0);
-				gtk_html_stream_printf (html_stream, "%s, ", html);
-				g_free (html);
+				if (l->data) {
+					char *html = e_text_to_html (l->data, 0);
+					gtk_html_stream_printf (html_stream, "%s, ", html);
+					g_free (html);
+				}
 			}
 			gtk_html_stream_printf (html_stream, "</td></tr></table>");
 		}


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