diff options
-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); |