From 91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 5 Dec 2012 08:19:04 -0500 Subject: Make EMailPartList thread-safe. Exposing data members in the public struct is unwise, especially when EMailPartList is used from multiple threads. Instead keep the members private and provide a set of thread-safe functions to manipulate them. --- em-format/e-mail-formatter-quote-attachment.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'em-format/e-mail-formatter-quote-attachment.c') diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c index 5f88d97bff..822c93fc2b 100644 --- a/em-format/e-mail-formatter-quote-attachment.c +++ b/em-format/e-mail-formatter-quote-attachment.c @@ -71,21 +71,18 @@ emfqe_attachment_format (EMailFormatterExtension *extension, gchar *text, *html; guint32 text_format_flags; EMailPartAttachment *empa; - EMailPart *att_part; - GSList *iter; + EMailPart *attachment_view_part; empa = E_MAIL_PART_ATTACHMENT (part); if (!empa->attachment_view_part_id) return FALSE; - iter = e_mail_part_list_get_iter ( - context->part_list->list, empa->attachment_view_part_id); - if (!iter || !iter->data) + attachment_view_part = e_mail_part_list_ref_part ( + context->part_list, empa->attachment_view_part_id); + if (attachment_view_part == NULL) return FALSE; - att_part = iter->data; - camel_stream_write_string (stream, "

", cancellable, NULL); text_format_flags = @@ -110,7 +107,8 @@ emfqe_attachment_format (EMailFormatterExtension *extension, "
\n", cancellable, NULL); e_mail_formatter_format_as ( - formatter, context, att_part, stream, NULL, cancellable); + formatter, context, attachment_view_part, + stream, NULL, cancellable); camel_stream_write_string ( stream, @@ -118,6 +116,8 @@ emfqe_attachment_format (EMailFormatterExtension *extension, "-->", cancellable, NULL); + e_mail_part_unref (attachment_view_part); + return TRUE; } -- cgit