diff options
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 6 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 6ece61726d..1f7021cb90 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2004-04-26 Jeffrey Stedfast <fejj@ximian.com> + + * e-msg-composer.c (autosave_load_draft): Only unlink the original + autosave draft file if we are successful in saving a new copy, + otherwise don't unlink the file. Fixes bug #57540. + 2004-04-23 Not Zed <NotZed@Ximian.com> * e-msg-composer-attachment-bar.c (update): fallback to stock diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index f17c3c5a7d..b355e85db3 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1366,19 +1366,18 @@ autosave_load_draft (const char *filename) g_return_val_if_fail (filename != NULL, NULL); g_warning ("autosave load filename = \"%s\"", filename); - - stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0); - if (stream == NULL) + if (!(stream = camel_stream_fs_new_with_name (filename, O_RDONLY, 0))) return NULL; - + msg = camel_mime_message_new (); camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream); - unlink (filename); + camel_object_unref (stream); composer = e_msg_composer_new_with_message (msg); if (composer) { - autosave_save_draft (composer); + if (autosave_save_draft (composer)) + unlink (filename); g_signal_connect (GTK_OBJECT (composer), "send", G_CALLBACK (em_utils_composer_send_cb), NULL); @@ -1389,7 +1388,6 @@ autosave_load_draft (const char *filename) gtk_widget_show (GTK_WIDGET (composer)); } - camel_object_unref (stream); return composer; } @@ -1565,9 +1563,9 @@ autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) /* only remove the file if we can successfully save it */ /* FIXME this test could probably be more efficient */ - if (autosave_save_draft (composer)) { + if (autosave_save_draft (composer)) unlink (composer->autosave_file); - } + close (composer->autosave_fd); g_free (composer->autosave_file); composer->autosave_file = NULL; |