diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-08-13 03:36:08 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-08-13 03:36:08 +0800 |
commit | 91af6345792cb2824f714df5249d5fc4c035f783 (patch) | |
tree | 6258d92395b054896ad917fd71f65809c4ff6ac5 /composer/e-msg-composer-attachment.c | |
parent | 377a4e07ab44804bca74b1a1806d2d3220a9815c (diff) | |
download | gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.tar gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.tar.gz gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.tar.bz2 gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.tar.lz gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.tar.xz gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.tar.zst gsoc2013-evolution-91af6345792cb2824f714df5249d5fc4c035f783.zip |
Don't call new_from_mime_part() since that function now does some copying
2002-08-12 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer-attachment.c (e_msg_composer_attachment_new):
Don't call new_from_mime_part() since that function now does some
copying of the mime part rather than simply reffing it.
(e_msg_composer_attachment_new_from_mime_part): Make a copy of the
MIME part so that if the message that this part belongs to gets
deleted from the the remote store, the composer will still have a
copy of it. Fixes bug #20308.
svn path=/trunk/; revision=17760
Diffstat (limited to 'composer/e-msg-composer-attachment.c')
-rw-r--r-- | composer/e-msg-composer-attachment.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c index 7036461bbf..e0c2bd1f0f 100644 --- a/composer/e-msg-composer-attachment.c +++ b/composer/e-msg-composer-attachment.c @@ -216,9 +216,9 @@ e_msg_composer_attachment_new (const char *file_name, g_free (content_id); #endif - new = e_msg_composer_attachment_new_from_mime_part (part); - camel_object_unref (CAMEL_OBJECT (part)); - + new = gtk_type_new (e_msg_composer_attachment_get_type ()); + new->editor_gui = NULL; + new->body = part; new->size = statbuf.st_size; new->guessed_type = TRUE; @@ -236,17 +236,34 @@ EMsgComposerAttachment * e_msg_composer_attachment_new_from_mime_part (CamelMimePart *part) { EMsgComposerAttachment *new; - + CamelMimePart *mime_part; + CamelStream *stream; + g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL); - + + stream = camel_stream_mem_new (); + if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (part), stream) == -1) { + camel_object_unref (stream); + return NULL; + } + + camel_stream_reset (stream); + mime_part = camel_mime_part_new (); + + if (camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (mime_part), stream) == -1) { + camel_object_unref (mime_part); + camel_object_unref (stream); + return NULL; + } + + camel_object_unref (stream); + new = gtk_type_new (e_msg_composer_attachment_get_type ()); - new->editor_gui = NULL; - new->body = part; - camel_object_ref (CAMEL_OBJECT (part)); + new->body = mime_part; new->guessed_type = FALSE; new->size = 0; - + return new; } |