aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-02-10 22:59:24 +0800
committerMilan Crha <mcrha@redhat.com>2014-02-10 23:04:27 +0800
commit614d1618054eb76fafe266009a0258472525f474 (patch)
tree7830d4f356d24b2e4084381a227abcbf2b14b37c /em-format
parenta8e46543b9ff6915d6ff15dbe2943020fbd4e436 (diff)
downloadgsoc2013-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.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/e-mail-part-attachment-bar.c17
1 files changed, 12 insertions, 5 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;
}