aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-01-19 16:38:55 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-01-19 16:38:55 +0800
commita3af35f7b66f27331c9f20d80d12a1173760313c (patch)
treedcfbd2b7aef7589220d5725bf9d936e4e50ab659 /mail
parentc1cb4235dbac007329e627a7d5132fe0d4188934 (diff)
downloadgsoc2013-evolution-a3af35f7b66f27331c9f20d80d12a1173760313c.tar.gz
gsoc2013-evolution-a3af35f7b66f27331c9f20d80d12a1173760313c.tar.zst
gsoc2013-evolution-a3af35f7b66f27331c9f20d80d12a1173760313c.zip
** See bug #66943.
2005-01-19 Not Zed <NotZed@Ximian.com> ** See bug #66943. * em-composer-utils.c (save_draft_done): check if the editor_engine is still there before trying to invoke a method on it. (em_utils_composer_save_draft_cb): grab resources before getting the folder, so the composer doesn't go away. svn path=/trunk/; revision=28445
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-composer-utils.c47
2 files changed, 40 insertions, 17 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 801d51745a..fec2c1c4a9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2005-01-19 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #66943.
+
+ * em-composer-utils.c (save_draft_done): check if the
+ editor_engine is still there before trying to invoke a method on
+ it.
+ (em_utils_composer_save_draft_cb): grab resources before getting
+ the folder, so the composer doesn't go away.
+
2005-01-18 Rodrigo Moya <rodrigo@novell.com>
* em-filter-source-element.c:
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 5653107082..e7b0a7aa35 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -468,6 +468,7 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data)
struct _save_draft_info {
struct emcs_t *emcs;
EMsgComposer *composer;
+ CamelMessageInfo *info;
int quit;
};
@@ -481,10 +482,12 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
if (!ok)
goto done;
-
- CORBA_exception_init (&ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (sdi->composer->editor_engine, "saved", &ev);
- CORBA_exception_free (&ev);
+
+ if (sdi->composer->editor_engine) {
+ CORBA_exception_init (&ev);
+ GNOME_GtkHTML_Editor_Engine_runCommand (sdi->composer->editor_engine, "saved", &ev);
+ CORBA_exception_free (&ev);
+ }
if ((emcs = sdi->emcs) == NULL) {
emcs = emcs_new ();
@@ -555,8 +558,22 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user
CamelMimeMessage *msg;
CamelMessageInfo *info;
EAccount *account;
-
+
+ /* need to get stuff from the composer here, since it could
+ * get destroyed while we're in mail_msg_wait() a little lower
+ * down, waiting for the folder to open */
+
+ g_object_ref(composer);
+ msg = e_msg_composer_get_message_draft (composer);
account = e_msg_composer_get_preferred_account (composer);
+
+ sdi = g_malloc(sizeof(struct _save_draft_info));
+ sdi->composer = composer;
+ sdi->emcs = user_data;
+ if (sdi->emcs)
+ emcs_ref(sdi->emcs);
+ sdi->quit = quit;
+
if (account && account->drafts_folder_uri &&
strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) {
int id;
@@ -565,8 +582,14 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user
mail_msg_wait (id);
if (!folder) {
- if (e_error_run((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES)
+ if (e_error_run((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) {
+ g_object_unref(composer);
+ camel_object_unref(msg);
+ if (sdi->emcs)
+ emcs_unref(sdi->emcs);
+ g_free(sdi);
return;
+ }
folder = drafts_folder;
camel_object_ref (drafts_folder);
@@ -576,19 +599,9 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user
camel_object_ref (folder);
}
- msg = e_msg_composer_get_message_draft (composer);
-
info = camel_message_info_new(NULL);
camel_message_info_set_flags(info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0);
-
- sdi = g_malloc (sizeof (struct _save_draft_info));
- sdi->composer = composer;
- g_object_ref (composer);
- sdi->emcs = user_data;
- if (sdi->emcs)
- emcs_ref (sdi->emcs);
- sdi->quit = quit;
-
+
mail_append_mail (folder, msg, info, save_draft_done, sdi);
camel_object_unref (folder);
camel_object_unref (msg);