patch for bug 348679

Parthasarathi Susarla <[email protected]> Thu, 19 Oct 2006 01:01:18 +0530
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <1161199878.15282.2.camel@localhost>
Accessing the structure members directly (as was the case) is the reason for
the crash.
The cameldatawrapper class provides methods to determine mime type, use that
instead of trying to access the member variable. 

The attached patch fixes the issue.

Find the patch attached at : http://bugzilla.gnome.org/show_bug.cgi?id=348679

Thanks,
partha

-- 
Parthasarathi S A
ajaysusarla at gmail dot com

Where I go, I dont need a road.

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
348679.diff (text/x-patch, 2.5 KB)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/import-ics-attachments/ChangeLog,v
retrieving revision 1.5
diff -u -p -r1.5 ChangeLog
--- ChangeLog	16 Oct 2006 13:55:02 -0000	1.5
+++ ChangeLog	18 Oct 2006 19:26:55 -0000
@@ -1,3 +1,11 @@
+2006-10-19  Parthasarathi Susarla <[email protected]>
+	
+	** Fix bug #348679
+
+	* icsimporter.c: (org_gnome_evolution_import_ics_attachment):
+	Do not access structure elements directly. Use the methods of the
+	class in the CamelDataWrapper Class
+	  
 2006-08-28  Kjartan Maraas  <[email protected]>
 
 	* org-gnome-evolution-mail-attachments-import-ics.eplug.xml: Mark
Index: icsimporter.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/import-ics-attachments/icsimporter.c,v
retrieving revision 1.5
diff -u -p -r1.5 icsimporter.c
--- icsimporter.c	23 Aug 2006 14:05:21 -0000	1.5
+++ icsimporter.c	18 Oct 2006 19:26:55 -0000
@@ -95,23 +95,28 @@ void org_gnome_evolution_import_ics_atta
 	icalcomponent_kind kind;
 	int len = 0;
 	int i = 0;
+	CamelContentType *type;
 
 	len = g_slist_length(t->attachments);
 	
-	if (len !=1 || !camel_content_type_is(((CamelDataWrapper *) ((EAttachment *) t->attachments->data)->body)->mime_type, "text", "calendar"))
+	if (len != 1)
 		return;
-	
+
+	type = camel_data_wrapper_get_mime_type_field (((CamelDataWrapper *) ((EAttachment *) t->attachments->data)->body));
+	if (type && camel_content_type_is(type, "text", "calendar")) {
+
 		kind = get_menu_type (t);
 
-	if (kind == ICAL_VTODO_COMPONENT ) {
-		for (i = 0; i < sizeof (popup_tasks_items) / sizeof (popup_tasks_items[0]); i++)
-			menus = g_slist_prepend (menus, &popup_tasks_items[i]);
-	} else if ( kind == ICAL_VEVENT_COMPONENT) {
-		for (i = 0; i < sizeof (popup_calendar_items) / sizeof (popup_calendar_items[0]); i++)
-			menus = g_slist_prepend (menus, &popup_calendar_items[i]);
-	}
+		if (kind == ICAL_VTODO_COMPONENT ) {
+			for (i = 0; i < sizeof (popup_tasks_items) / sizeof (popup_tasks_items[0]); i++)
+				menus = g_slist_prepend (menus, &popup_tasks_items[i]);
+		} else if ( kind == ICAL_VEVENT_COMPONENT) {
+			for (i = 0; i < sizeof (popup_calendar_items) / sizeof (popup_calendar_items[0]); i++)
+				menus = g_slist_prepend (menus, &popup_calendar_items[i]);
+		}
 
-	e_popup_add_items (t->target.popup, menus, NULL, popup_free, t);
+		e_popup_add_items (t->target.popup, menus, NULL, popup_free, t);
+	}
 }
 
 void org_gnome_evolution_import_ics_part (EPlugin*ep, EMPopupTargetPart *t)