From f19058ea7a002e8ebf8351c55a86d3bb17a46cbc Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 18 May 2013 11:24:40 -0400 Subject: Add e_mail_part_ref_mime_part(). --- em-format/e-mail-formatter-text-plain.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'em-format/e-mail-formatter-text-plain.c') diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c index 33ede66957..638f0119a1 100644 --- a/em-format/e-mail-formatter-text-plain.c +++ b/em-format/e-mail-formatter-text-plain.c @@ -54,7 +54,6 @@ emfe_text_plain_format (EMailFormatterExtension *extension, CamelStream *stream, GCancellable *cancellable) { - CamelDataWrapper *dw; CamelStream *filtered_stream; CamelMimeFilter *html_filter; gchar *content; @@ -67,6 +66,8 @@ emfe_text_plain_format (EMailFormatterExtension *extension, if ((context->mode == E_MAIL_FORMATTER_MODE_RAW) || (context->mode == E_MAIL_FORMATTER_MODE_PRINTING)) { CamelMimeFilterToHTMLFlags flags; + CamelMimePart *mime_part; + CamelDataWrapper *dw; if (context->mode == E_MAIL_FORMATTER_MODE_RAW) { gchar *header; @@ -83,9 +84,12 @@ emfe_text_plain_format (EMailFormatterExtension *extension, flags = e_mail_formatter_get_text_format_flags (formatter); - dw = camel_medium_get_content (CAMEL_MEDIUM (part->part)); - if (!dw) + mime_part = e_mail_part_ref_mime_part (part); + dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); + if (dw == NULL) { + g_object_unref (mime_part); return FALSE; + } /* Check for RFC 2646 flowed text. */ if (camel_content_type_is (dw->mime_type, "text", "plain") @@ -129,6 +133,8 @@ emfe_text_plain_format (EMailFormatterExtension *extension, cancellable, NULL); } + g_object_unref (mime_part); + return TRUE; } else { -- cgit v1.2.3