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/prefer-plain | |
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/prefer-plain')
-rw-r--r-- | modules/prefer-plain/e-mail-display-popup-prefer-plain.c | 15 |
1 files changed, 10 insertions, 5 deletions
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); |