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. --- mail/e-mail-request.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mail/e-mail-request.c') diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c index b07b5f0c49..665711f927 100644 --- a/mail/e-mail-request.c +++ b/mail/e-mail-request.c @@ -116,7 +116,7 @@ handle_mail_request (GSimpleAsyncResult *res, const gchar *mime_type; /* original part_id is owned by the GHashTable */ part_id = soup_uri_decode (part_id); - part = e_mail_part_list_find_part (part_list, part_id); + part = e_mail_part_list_ref_part (part_list, part_id); val = g_hash_table_lookup (request->priv->uri_query, "mime_type"); if (val) { @@ -129,10 +129,11 @@ handle_mail_request (GSimpleAsyncResult *res, mime_type = "application/vnd.evolution.source"; } - if (part) { + if (part != NULL) { e_mail_formatter_format_as ( formatter, &context, part, request->priv->output_stream, mime_type ? mime_type : part->mime_type, cancellable); + e_mail_part_unref (part); } else { g_warning ("Failed to lookup requested part '%s' - this should not happen!", part_id); } -- cgit v1.2.3