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-button.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'e-util/e-attachment-button.c') diff --git a/e-util/e-attachment-button.c b/e-util/e-attachment-button.c index 7778bb106f..701b20eae1 100644 --- a/e-util/e-attachment-button.c +++ b/e-util/e-attachment-button.c @@ -277,7 +277,7 @@ attachment_button_expand_drag_data_get_cb (EAttachmentButton *button, attachment = e_attachment_button_get_attachment (button); if (attachment != NULL) - mime_type = e_attachment_get_mime_type (attachment); + mime_type = e_attachment_dup_mime_type (attachment); if (mime_type != NULL) { gboolean processed = FALSE; @@ -290,7 +290,7 @@ attachment_button_expand_drag_data_get_cb (EAttachmentButton *button, if (g_strcmp0 (atom_name, mime_type) == 0) { CamelMimePart *mime_part; - mime_part = e_attachment_get_mime_part (attachment); + mime_part = e_attachment_ref_mime_part (attachment); if (mime_part != NULL) { CamelDataWrapper *wrapper; @@ -314,6 +314,8 @@ attachment_button_expand_drag_data_get_cb (EAttachmentButton *button, processed = TRUE; g_byte_array_free (buffer, TRUE); + + g_object_unref (mime_part); } } @@ -789,7 +791,7 @@ e_attachment_button_set_attachment (EAttachmentButton *button, if (attachment != NULL) { gchar *simple_type; - simple_type = e_attachment_get_mime_type (attachment); + simple_type = e_attachment_dup_mime_type (attachment); if (simple_type != NULL) { GtkTargetEntry attach_entry[] = { { NULL, 0, 2 } }; -- cgit v1.2.3