aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-attachment.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-11-07 05:02:25 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-11-07 05:02:25 +0800
commit03972535919d96d55a409988f4436e0a5e54b96b (patch)
tree839d5a9fc5b184b3ec653427da169bd8398e6df5 /e-util/e-attachment.c
parente8f7f03ed29cd03c83c6a924c764554a89b9a7f1 (diff)
downloadgsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.tar
gsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.tar.gz
gsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.tar.bz2
gsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.tar.lz
gsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.tar.xz
gsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.tar.zst
gsoc2013-evolution-03972535919d96d55a409988f4436e0a5e54b96b.zip
Make e_attachment_set_file_info() thread-safe.
Missed this one in commit 9058c6f85dc49f9500e7e67819acfd8c0d2d369c.
Diffstat (limited to 'e-util/e-attachment.c')
-rw-r--r--e-util/e-attachment.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/e-util/e-attachment.c b/e-util/e-attachment.c
index b446d0a47a..e2b64ab92b 100644
--- a/e-util/e-attachment.c
+++ b/e-util/e-attachment.c
@@ -1341,14 +1341,16 @@ e_attachment_set_file_info (EAttachment *attachment,
GtkTreeRowReference *reference;
GIcon *icon;
- reference = e_attachment_get_reference (attachment);
+ g_return_if_fail (E_IS_ATTACHMENT (attachment));
- if (file_info != NULL)
+ if (file_info != NULL) {
+ g_return_if_fail (G_IS_FILE_INFO (file_info));
g_object_ref (file_info);
+ }
- if (attachment->priv->file_info != NULL)
- g_object_unref (attachment->priv->file_info);
+ g_mutex_lock (&attachment->priv->property_lock);
+ g_clear_object (&attachment->priv->file_info);
attachment->priv->file_info = file_info;
/* If the GFileInfo contains a GThemedIcon, append a
@@ -1358,9 +1360,12 @@ e_attachment_set_file_info (EAttachment *attachment,
g_themed_icon_append_name (
G_THEMED_ICON (icon), DEFAULT_ICON_NAME);
+ g_mutex_unlock (&attachment->priv->property_lock);
+
g_object_notify (G_OBJECT (attachment), "file-info");
/* Tell the EAttachmentStore its total size changed. */
+ reference = e_attachment_get_reference (attachment);
if (gtk_tree_row_reference_valid (reference)) {
GtkTreeModel *model;
model = gtk_tree_row_reference_get_model (reference);