aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-attachment-dialog.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-05-23 00:11:59 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-05-24 04:36:02 +0800
commit9058c6f85dc49f9500e7e67819acfd8c0d2d369c (patch)
tree5802baf603e0995132e3652a6681068f0d9f060a /e-util/e-attachment-dialog.c
parent256422cab27d0b7adbe99fdeaceb72cd78c129bb (diff)
downloadgsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.tar
gsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.tar.gz
gsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.tar.bz2
gsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.tar.lz
gsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.tar.xz
gsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.tar.zst
gsoc2013-evolution-9058c6f85dc49f9500e7e67819acfd8c0d2d369c.zip
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()
Diffstat (limited to 'e-util/e-attachment-dialog.c')
-rw-r--r--e-util/e-attachment-dialog.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/e-util/e-attachment-dialog.c b/e-util/e-attachment-dialog.c
index 9a9a1e7942..91021953f9 100644
--- a/e-util/e-attachment-dialog.c
+++ b/e-util/e-attachment-dialog.c
@@ -57,8 +57,8 @@ attachment_dialog_update (EAttachmentDialog *dialog)
GtkWidget *widget;
const gchar *content_type;
const gchar *display_name;
- const gchar *description;
- const gchar *disposition;
+ gchar *description;
+ gchar *disposition;
gchar *type_description = NULL;
gboolean sensitive;
gboolean active;
@@ -66,9 +66,9 @@ attachment_dialog_update (EAttachmentDialog *dialog)
attachment = e_attachment_dialog_get_attachment (dialog);
if (attachment != NULL) {
- file_info = e_attachment_get_file_info (attachment);
- description = e_attachment_get_description (attachment);
- disposition = e_attachment_get_disposition (attachment);
+ file_info = e_attachment_ref_file_info (attachment);
+ description = e_attachment_dup_description (attachment);
+ disposition = e_attachment_dup_disposition (attachment);
} else {
file_info = NULL;
description = NULL;
@@ -120,7 +120,11 @@ attachment_dialog_update (EAttachmentDialog *dialog)
gtk_widget_set_sensitive (widget, sensitive);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), active);
+ g_free (description);
+ g_free (disposition);
g_free (type_description);
+
+ g_clear_object (&file_info);
}
static void
@@ -231,10 +235,10 @@ attachment_dialog_response (GtkDialog *dialog,
g_return_if_fail (E_IS_ATTACHMENT (priv->attachment));
attachment = priv->attachment;
- file_info = e_attachment_get_file_info (attachment);
+ file_info = e_attachment_ref_file_info (attachment);
g_return_if_fail (G_IS_FILE_INFO (file_info));
- mime_part = e_attachment_get_mime_part (attachment);
+ mime_part = e_attachment_ref_mime_part (attachment);
attribute = G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME;
text = gtk_entry_get_text (GTK_ENTRY (priv->display_name_entry));
@@ -258,6 +262,9 @@ attachment_dialog_response (GtkDialog *dialog,
if (mime_part != NULL)
camel_mime_part_set_disposition (mime_part, text);
+ g_clear_object (&file_info);
+ g_clear_object (&mime_part);
+
g_object_notify (G_OBJECT (attachment), "file-info");
}