aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-04-27 02:50:08 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-04-27 02:50:08 +0800
commit9fe61b12b4147568c15e2a3649f5a30d8c7bdab1 (patch)
tree0e02b105dca3611e9985b72851c868d82288a383 /composer/e-msg-composer.c
parentebbd29334a2a755f927afbaeb06c99ab6709008b (diff)
downloadgsoc2013-evolution-9fe61b12b4147568c15e2a3649f5a30d8c7bdab1.tar.gz
gsoc2013-evolution-9fe61b12b4147568c15e2a3649f5a30d8c7bdab1.tar.zst
gsoc2013-evolution-9fe61b12b4147568c15e2a3649f5a30d8c7bdab1.zip
Only unlink the original autosave draft file if we are successful in
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. svn path=/trunk/; revision=25619
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c16
1 files changed, 7 insertions, 9 deletions
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;