diff options
author | Milan Crha <mcrha@redhat.com> | 2014-02-10 22:59:24 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-02-10 23:04:27 +0800 |
commit | 614d1618054eb76fafe266009a0258472525f474 (patch) | |
tree | 7830d4f356d24b2e4084381a227abcbf2b14b37c | |
parent | a8e46543b9ff6915d6ff15dbe2943020fbd4e436 (diff) | |
download | gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.tar gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.tar.gz gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.tar.bz2 gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.tar.lz gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.tar.xz gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.tar.zst gsoc2013-evolution-614d1618054eb76fafe266009a0258472525f474.zip |
Bug #724023 - Run EMailFormatter in the main/UI thread
Any GtkWidget creation or manipulation should be done exclusively
from the main/UI thread, thus make sure it is done that way.
Of course, evolution can freeze for a little time (depends on the message
size), until its formatting is done. It's unnoticeable with usual messages.
-rw-r--r-- | em-format/e-mail-part-attachment-bar.c | 17 | ||||
-rw-r--r-- | mail/e-mail-request.c | 9 |
2 files changed, 18 insertions, 8 deletions
diff --git a/em-format/e-mail-part-attachment-bar.c b/em-format/e-mail-part-attachment-bar.c index dd029ce12e..604581e9f6 100644 --- a/em-format/e-mail-part-attachment-bar.c +++ b/em-format/e-mail-part-attachment-bar.c @@ -59,12 +59,7 @@ e_mail_part_attachment_bar_class_init (EMailPartAttachmentBarClass *class) static void e_mail_part_attachment_bar_init (EMailPartAttachmentBar *part) { - GtkTreeModel *tree_model; - part->priv = E_MAIL_PART_ATTACHMENT_BAR_GET_PRIVATE (part); - - tree_model = e_attachment_store_new (); - part->priv->store = E_ATTACHMENT_STORE (tree_model); } EMailPart * @@ -83,6 +78,18 @@ e_mail_part_attachment_bar_get_store (EMailPartAttachmentBar *part) { g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT_BAR (part), NULL); + if (!part->priv->store) { + GtkTreeModel *tree_model; + + /* Create the store only on demand. The EMailParser runs in a dedicated + thread, but the EAttachmentStore is a GtkWidget descendant, which should + be manipulated only from the main/UI thread, thus postpone its creating + until it's really needed, which might be during the EMailFormatter run, + which runs from the main/UI thread. */ + tree_model = e_attachment_store_new (); + part->priv->store = E_ATTACHMENT_STORE (tree_model); + } + return part->priv->store; } diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c index 83cc489525..eb1a32b02c 100644 --- a/mail/e-mail-request.c +++ b/mail/e-mail-request.c @@ -364,9 +364,12 @@ mail_request_send_async (SoupRequest *request, simple, handle_contact_photo_request, G_PRIORITY_DEFAULT, cancellable); } else { - g_simple_async_result_run_in_thread ( - simple, handle_mail_request, - G_PRIORITY_DEFAULT, cancellable); + /* Process e-mail mail requests in this thread, which should be + the main/UI thread, because any EMailFormatter can create + GtkWidget-s, or manipulate with them, which should be always + done in the main/UI thread. */ + handle_mail_request (simple, G_OBJECT (request), cancellable); + g_simple_async_result_complete_in_idle (simple); } g_object_unref (simple); |