From 9058c6f85dc49f9500e7e67819acfd8c0d2d369c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 22 May 2013 12:11:59 -0400 Subject: Make EAttachment a little more thread-safe. EAttachment is now used from worker threads by EMailFormatterAttachment, so add some thread-safe accessor functions to eliminate potential races. Added thread-safe functions: e_attachment_dup_disposition() e_attachment_ref_file() e_attachment_ref_file_info() e_attachment_ref_icon() e_attachment_ref_mime_part() e_attachment_dup_description() e_attachment_dup_thumbnail_path() Renamed functions: e_attachment_get_mime_type() -> e_attachment_dup_mime_type() Removed non-thread-safe functions: e_attachment_get_file() e_attachment_get_file_info() e_attachment_get_icon() e_attachment_get_mime_part() e_attachment_get_description() e_attachment_get_thumbnail_path() --- e-util/e-attachment-view.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'e-util/e-attachment-view.c') diff --git a/e-util/e-attachment-view.c b/e-util/e-attachment-view.c index d078bd4b26..1fb868ed8b 100644 --- a/e-util/e-attachment-view.c +++ b/e-util/e-attachment-view.c @@ -174,7 +174,7 @@ action_open_with_cb (GtkAction *action, E_ATTACHMENT_STORE_COLUMN_ATTACHMENT, &attachment, -1); g_return_if_fail (E_IS_ATTACHMENT (attachment)); - file_info = e_attachment_get_file_info (attachment); + file_info = e_attachment_ref_file_info (attachment); g_return_if_fail (file_info != NULL); content_type = g_file_info_get_content_type (file_info); @@ -192,6 +192,8 @@ action_open_with_cb (GtkAction *action, g_object_unref (app_info); } + g_object_unref (file_info); + g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL); g_list_free (list); } @@ -1560,7 +1562,7 @@ e_attachment_view_drag_begin (EAttachmentView *view, gint width, height; attachment = E_ATTACHMENT (priv->selected->data); - icon = e_attachment_get_icon (attachment); + icon = e_attachment_ref_icon (attachment); g_return_if_fail (icon != NULL); icon_theme = gtk_icon_theme_get_default (); @@ -1587,6 +1589,8 @@ e_attachment_view_drag_begin (EAttachmentView *view, gtk_icon_info_free (icon_info); } + + g_object_unref (icon); } } -- cgit v1.2.3