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() --- calendar/gui/dialogs/comp-editor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 778e69008d..39ca3a81e1 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -3208,7 +3208,7 @@ attachment_loaded_cb (EAttachment *attachment, * So this is a lazy migration from the old form to the new. */ - file_info = e_attachment_get_file_info (attachment); + file_info = e_attachment_ref_file_info (attachment); if (file_info == NULL) { /* failed to load an attachment file */ e_attachment_load_handle_error (attachment, result, parent); @@ -3225,6 +3225,8 @@ attachment_loaded_cb (EAttachment *attachment, g_free (new_name); } + g_object_unref (file_info); + e_attachment_load_handle_error (attachment, result, parent); } @@ -3703,7 +3705,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) column_id = E_ATTACHMENT_STORE_COLUMN_ATTACHMENT; gtk_tree_model_get (model, &iter, column_id, &attachment, -1); - mime_part = e_attachment_get_mime_part (attachment); + mime_part = e_attachment_ref_mime_part (attachment); g_object_unref (attachment); valid = gtk_tree_model_iter_next (model, &iter); @@ -3743,6 +3745,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor) attach_list = g_slist_append (attach_list, cal_mime_attach); + g_object_unref (mime_part); g_object_unref (stream); } -- cgit v1.2.3