diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-05 21:19:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-08 03:01:04 +0800 |
commit | 91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8 (patch) | |
tree | 1c06f36fa153eee0779cdfa1be1a24f62e93787d /modules | |
parent | 2f0d83cf74b94d5e6272c07179df6e6c7a929789 (diff) | |
download | gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.tar gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.tar.gz gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.tar.bz2 gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.tar.lz gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.tar.xz gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.tar.zst gsoc2013-evolution-91822b42dc7b5eb64cad2626f9fc620a2ee6a2c8.zip |
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.
Diffstat (limited to 'modules')
5 files changed, 23 insertions, 14 deletions
diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c index 15b7df42a6..54cb096292 100644 --- a/modules/itip-formatter/e-mail-formatter-itip.c +++ b/modules/itip-formatter/e-mail-formatter-itip.c @@ -95,9 +95,9 @@ emfe_itip_format (EMailFormatterExtension *extension, const gchar *message_uid; gchar *uri; - folder = context->part_list->folder; - message = context->part_list->message; - message_uid = context->part_list->message_uid; + folder = e_mail_part_list_get_folder (context->part_list); + message = e_mail_part_list_get_message (context->part_list); + message_uid = e_mail_part_list_get_message_uid (context->part_list); /* mark message as containing calendar, thus it will show the * icon in message list now on */ diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index c05e8518fe..9a56c00357 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -1061,8 +1061,10 @@ message_parsed_cb (GObject *source_object, EMailPartList *parts_list; GObject *preview = user_data; EMailDisplay *display; + CamelFolder *folder; SoupSession *soup_session; GHashTable *mails; + const gchar *message_uid; gchar *mail_uri; display = g_object_get_data (preview, "mbox-imp-display"); @@ -1078,8 +1080,10 @@ message_parsed_cb (GObject *source_object, g_object_set_data ( G_OBJECT (soup_session), "mails", mails); } - mail_uri = e_mail_part_build_uri ( - parts_list->folder, parts_list->message_uid, NULL, NULL); + + folder = e_mail_part_list_get_folder (parts_list); + message_uid = e_mail_part_list_get_message_uid (parts_list); + mail_uri = e_mail_part_build_uri (folder, message_uid, NULL, NULL); g_hash_table_insert (mails, mail_uri, parts_list); diff --git a/modules/prefer-plain/e-mail-display-popup-prefer-plain.c b/modules/prefer-plain/e-mail-display-popup-prefer-plain.c index 58969a6b19..2be2532eda 100644 --- a/modules/prefer-plain/e-mail-display-popup-prefer-plain.c +++ b/modules/prefer-plain/e-mail-display-popup-prefer-plain.c @@ -228,10 +228,11 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte SoupURI *soup_uri; GHashTable *query; EMailPartList *part_list; - GSList *iter; gboolean is_text_plain; const gchar *action_name; EMailDisplayPopupPreferPlain *pp_extension; + GQueue queue = G_QUEUE_INIT; + GList *head, *link; display = E_MAIL_DISPLAY (e_extension_get_extensible ( E_EXTENSION (extension))); @@ -307,10 +308,11 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte action_name = NULL; part_list = e_mail_display_get_parts_list (display); - for (iter = part_list->list; iter; iter = g_slist_next (iter)) { - EMailPart *p = iter->data; - if (!p) - continue; + e_mail_part_list_queue_parts (part_list, NULL, &queue); + head = g_queue_peek_head_link (&queue); + + for (link = head; link != NULL; link = g_list_next (link)) { + EMailPart *p = link->data; if (g_str_has_prefix (p->id, prefix) && (strstr (p->id, "text_html") || strstr (p->id, "plain_text"))) { @@ -335,6 +337,9 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte } } + while (!g_queue_is_empty (&queue)) + e_mail_part_unref (g_queue_pop_head (&queue)); + if (action_name) { action = gtk_action_group_get_action ( pp_extension->action_group, action_name); diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c index d8907034db..43c3a139c5 100644 --- a/modules/text-highlight/e-mail-formatter-text-highlight.c +++ b/modules/text-highlight/e-mail-formatter-text-highlight.c @@ -324,8 +324,8 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, gchar *uri, *str; gchar *syntax; - folder = context->part_list->folder; - message_uid = context->part_list->message_uid; + folder = e_mail_part_list_get_folder (context->part_list); + message_uid = e_mail_part_list_get_message_uid (context->part_list); syntax = get_syntax (part, NULL); diff --git a/modules/vcard-inline/e-mail-formatter-vcard-inline.c b/modules/vcard-inline/e-mail-formatter-vcard-inline.c index a0091e985f..13e87139ac 100644 --- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c +++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c @@ -102,8 +102,8 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension, if (length < 1) return FALSE; - folder = context->part_list->folder; - message_uid = context->part_list->message_uid; + folder = e_mail_part_list_get_folder (context->part_list); + message_uid = e_mail_part_list_get_message_uid (context->part_list); if (vcard_part->message_uid == NULL && message_uid != NULL) vcard_part->message_uid = g_strdup (message_uid); |