[evolution] Bug #606316 - Mail with an attachment in a Junk folder crashes Evo



commit d52040f42b0964b6f56f639bc6bc99c6f1a9906f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 7 18:33:59 2010 +0100

    Bug #606316 - Mail with an attachment in a Junk folder crashes Evo

 mail/em-format-html-display.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 9228aec..ccbf531 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -801,20 +801,23 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
 	gpointer parent;
 	EMFormat *emf = (EMFormat *) efh;
 	CamelMessageInfo *mi = NULL;
-	CamelMessageContentInfo *ci = NULL;
-	GFileInfo *fileinfo;
-	guint32 size;
+	guint32 size = 0;
 
 	/* FIXME: handle default shown case */
 	d(printf("adding attachment button/content\n"));
 
 	mi = camel_folder_summary_uid (emf->folder->summary, emf->uid);
-	ci = camel_folder_summary_guess_content_info (mi, ((CamelDataWrapper *)pobject->part)->mime_type);
-	if (ci) {
-		size = ci->size;
-		/* what if its not encoded in base64 ? is it a case to consider? */
-		if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64"))
-			size = size/1.37;
+	if (mi) {
+		const CamelMessageContentInfo *ci;
+
+		ci = camel_folder_summary_guess_content_info (mi, camel_mime_part_get_content_type (pobject->part));
+		if (ci) {
+			size = ci->size;
+			/* what if its not encoded in base64 ? is it a case to consider? */
+			if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64"))
+				size = size/1.37;
+		}
+		camel_message_info_free (mi);
 	}
 
 	info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid);
@@ -843,6 +846,8 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
 		info->attachment, (GAsyncReadyCallback)
 		e_attachment_load_handle_error, parent);
 	if (size != 0) {
+		GFileInfo *fileinfo;
+
 		fileinfo = e_attachment_get_file_info (info->attachment);
 		g_file_info_set_size (fileinfo, size);
 		e_attachment_set_file_info (info->attachment, fileinfo);



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