aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-04 09:53:36 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-04 09:53:36 +0800
commit1d4100c58a6a4506986ea22dc4cf6dbfe666ede1 (patch)
tree254f851105c5b885f728d627cfd74bd4b0aeecde
parent1d12357e619efc28b3616ad51d9fad0b7f46e53e (diff)
downloadgsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.tar
gsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.tar.gz
gsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.tar.bz2
gsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.tar.lz
gsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.tar.xz
gsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.tar.zst
gsoc2013-evolution-1d4100c58a6a4506986ea22dc4cf6dbfe666ede1.zip
Make sure to unref the message object so we don't leak it or any
2001-10-03 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (autosave_save_draft): Make sure to unref the message object so we don't leak it or any references to attachments (child mime parts). * e-msg-composer-attachment.c (e_msg_composer_attachment_new): Unref the mime part after passing it along to new_from_mime_part. svn path=/trunk/; revision=13402
-rw-r--r--composer/ChangeLog9
-rw-r--r--composer/e-msg-composer-attachment.c7
-rw-r--r--composer/e-msg-composer.c14
3 files changed, 22 insertions, 8 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 29c1f2c167..ab94b1509d 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-03 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-msg-composer.c (autosave_save_draft): Make sure to unref the
+ message object so we don't leak it or any references to
+ attachments (child mime parts).
+
+ * e-msg-composer-attachment.c (e_msg_composer_attachment_new):
+ Unref the mime part after passing it along to new_from_mime_part.
+
2001-10-02 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (save_draft): Pass an empty flags argument to
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
index 9231137317..b6085b6d17 100644
--- a/composer/e-msg-composer-attachment.c
+++ b/composer/e-msg-composer-attachment.c
@@ -63,7 +63,7 @@ destroy (GtkObject *object)
EMsgComposerAttachment *attachment;
attachment = E_MSG_COMPOSER_ATTACHMENT (object);
-
+
camel_object_unref (CAMEL_OBJECT (attachment->body));
if (attachment->pixbuf_cache != NULL)
gdk_pixbuf_unref (attachment->pixbuf_cache);
@@ -193,7 +193,7 @@ e_msg_composer_attachment_new (const gchar *file_name,
camel_mime_part_set_filename (part, filename);
g_free (filename);
-
+
#if 0
/* Note: Outlook 2002 is broken with respect to Content-Ids on
non-multipart/related parts, so as an interoperability
@@ -206,6 +206,7 @@ e_msg_composer_attachment_new (const gchar *file_name,
#endif
new = e_msg_composer_attachment_new_from_mime_part (part);
+ camel_object_unref (CAMEL_OBJECT (part));
new->size = statbuf.st_size;
new->guessed_type = TRUE;
@@ -346,7 +347,7 @@ ok_cb (GtkWidget *widget,
str = e_utf8_gtk_entry_get_text (dialog_data->mime_type_entry);
camel_mime_part_set_content_type (attachment->body, str);
-
+
camel_data_wrapper_set_mime_type (
camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str);
g_free (str);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index d8cf2cb397..fda86508ed 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1022,7 +1022,7 @@ static AutosaveManager *am = NULL;
static gboolean
autosave_save_draft (EMsgComposer *composer)
{
- CamelMimeMessage *msg;
+ CamelMimeMessage *message;
CamelStream *stream;
char *file;
gint fd;
@@ -1037,21 +1037,23 @@ autosave_save_draft (EMsgComposer *composer)
return FALSE;
}
- msg = e_msg_composer_get_message_draft (composer);
+ message = e_msg_composer_get_message_draft (composer);
- if (msg == NULL) {
+ if (message == NULL) {
e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Unable to retrieve message from editor"));
return FALSE;
}
if (lseek (fd, (off_t)0, SEEK_SET) == -1) {
+ camel_object_unref (CAMEL_OBJECT (message));
e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Unable to seek on file: %s\n%s"), file, g_strerror (errno));
return FALSE;
}
if (ftruncate (fd, (off_t)0) == -1) {
+ camel_object_unref (CAMEL_OBJECT (message));
e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Unable to truncate file: %s\n%s"), file, g_strerror (errno));
return FALSE;
@@ -1059,7 +1061,7 @@ autosave_save_draft (EMsgComposer *composer)
/* this does an lseek so we don't have to */
stream = camel_stream_fs_new_with_fd (fd);
- if (camel_data_wrapper_write_to_stream ((CamelDataWrapper *)msg, stream) == -1
+ if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream) == -1
|| camel_stream_flush (CAMEL_STREAM (stream)) == -1) {
e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Error autosaving message: %s\n %s"), file, strerror(errno));
@@ -1070,7 +1072,9 @@ autosave_save_draft (EMsgComposer *composer)
/* set the fd to -1 in the stream so camel doesn't close it we want to keep it open */
CAMEL_STREAM_FS (stream)->fd = -1;
camel_object_unref (CAMEL_OBJECT (stream));
-
+
+ camel_object_unref (CAMEL_OBJECT (message));
+
return success;
}