aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-07-09 06:59:23 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-07-09 06:59:23 +0800
commita2ab50c057cbe9baafa63372767c5022901838f6 (patch)
treec91c81252034914677e56926357cc95627ce538b /mail
parent82c99d625bf2d763adf0b812dd59b92a4aaa4735 (diff)
downloadgsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.tar
gsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.tar.gz
gsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.tar.bz2
gsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.tar.lz
gsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.tar.xz
gsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.tar.zst
gsoc2013-evolution-a2ab50c057cbe9baafa63372767c5022901838f6.zip
Don't ever use the mail-display's current_message, this can cause
2002-07-08 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (redirect): Don't ever use the mail-display's current_message, this can cause problems. * mail-ops.c (get_message_free): Unref the gotten message. All of the callers seemed to think that they didn't have to unref the message. * mail-display.c (mail_display_set_message): Now refs the message. (mail_display_destroy): Unref the current_message if we still have ownership of it. svn path=/trunk/; revision=17387
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/folder-browser.c12
-rw-r--r--mail/mail-callbacks.c22
-rw-r--r--mail/mail-display.c14
-rw-r--r--mail/mail-ops.c23
-rw-r--r--mail/mail-ops.h2
6 files changed, 53 insertions, 33 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 974e7f21ee..9e42c25a82 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+2002-07-08 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-callbacks.c (redirect): Don't ever use the mail-display's
+ current_message, this can cause problems.
+
+ * mail-ops.c (get_message_free): Unref the gotten message. All of
+ the callers seemed to think that they didn't have to unref the
+ message.
+
+ * mail-display.c (mail_display_set_message): Now refs the message.
+ (mail_display_destroy): Unref the current_message if we still have
+ ownership of it.
+
2002-07-05 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (composer_send_queued_cb): Only queue a send
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 03a7190aa3..efae51d74a 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -1397,13 +1397,13 @@ filter_data_free(struct _filter_data *fdata)
}
static void
-vfolder_type_got_message(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *d)
+vfolder_type_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *d)
{
struct _filter_data *data = d;
-
+
if (msg)
vfolder_gui_add_from_message(msg, data->type, data->uri);
-
+
filter_data_free(data);
}
@@ -1426,7 +1426,7 @@ static void vfolder_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { vf
static void vfolder_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_gui_add_from_mlist(fdata->mlist, fdata->uri); }
static void
-filter_type_got_message(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *d)
+filter_type_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *d)
{
struct _filter_data *data = d;
@@ -2337,7 +2337,7 @@ do_mark_seen (gpointer data)
/* if we have pending uid's, it means another was selected before we finished displaying
the last one - so we cycle through and start loading the pending one immediately now */
static void
-done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
+done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data)
{
FolderBrowser *fb = data;
int timeout = mail_config_get_mark_as_seen_timeout ();
@@ -2366,7 +2366,7 @@ done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, vo
g_free (fb->loaded_uid);
fb->loaded_uid = fb->loading_uid;
fb->loading_uid = NULL;
-
+
folder_browser_ui_message_loaded (fb);
/* if we are still on the same message, do the 'idle read' thing */
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index c00515135e..e55fb9fd23 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1063,7 +1063,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
}
static void
-requeue_mail_reply (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
+requeue_mail_reply (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data)
{
int mode = GPOINTER_TO_INT (data);
@@ -1350,7 +1350,7 @@ redirect_get_composer (CamelMimeMessage *message)
}
static void
-do_redirect (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+do_redirect (CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *data)
{
EMsgComposer *composer;
@@ -1382,14 +1382,8 @@ redirect (GtkWidget *widget, gpointer user_data)
if (!check_send_configuration (fb))
return;
- if (fb->mail_display && fb->mail_display->current_message) {
- do_redirect (fb->folder, NULL,
- fb->mail_display->current_message,
- NULL);
- } else {
- mail_get_message (fb->folder, fb->message_list->cursor_uid,
- do_redirect, NULL, mail_thread_new);
- }
+ mail_get_message (fb->folder, fb->message_list->cursor_uid,
+ do_redirect, NULL, mail_thread_new);
}
static void
@@ -2920,7 +2914,7 @@ struct blarg_this_sucks {
};
static void
-done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
+done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data)
{
struct blarg_this_sucks *blarg = data;
FolderBrowser *fb = blarg->fb;
@@ -3042,7 +3036,7 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
-do_view_digest (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+do_view_digest (CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *data)
{
FolderBrowser *folder_browser = FOLDER_BROWSER (data);
@@ -3092,6 +3086,7 @@ view_digest (GtkWidget *widget, gpointer user_data)
if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
return;
+ /* FIXME: use mail_get_messages() */
for (i = 0; i < uids->len; i++) {
mail_get_message (fb->folder, uids->pdata [i], do_view_digest, fb, mail_thread_queued);
g_free (uids->pdata [i]);
@@ -3100,7 +3095,7 @@ view_digest (GtkWidget *widget, gpointer user_data)
}
static void
-do_view_message (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+do_view_message (CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *data)
{
FolderBrowser *fb = FOLDER_BROWSER (data);
@@ -3132,6 +3127,7 @@ view_msg (GtkWidget *widget, gpointer user_data)
if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
return;
+ /* FIXME: use mail_get_messages() */
for (i = 0; i < uids->len; i++) {
mail_get_message (fb->folder, uids->pdata [i], do_view_message, fb, mail_thread_queued);
g_free (uids->pdata [i]);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 0832875605..b5e57f6015 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -1626,7 +1626,11 @@ mail_display_set_message (MailDisplay *md, CamelMedium *medium, const char *foll
g_free (md->followup);
- md->current_message = (CamelMimeMessage *) medium;
+ if (medium) {
+ camel_object_ref (medium);
+ md->current_message = (CamelMimeMessage *) medium;
+ } else
+ md->current_message = NULL;
md->followup = followup ? message_tag_followup_decode (followup) : NULL;
@@ -1639,9 +1643,9 @@ mail_display_set_message (MailDisplay *md, CamelMedium *medium, const char *foll
}
/**
- * mail_display_set_message:
+ * mail_display_set_charset:
* @mail_display: the mail display object
- * @medium: the input camel medium, or %NULL
+ * @charset: charset or %NULL
*
* Makes the mail_display object show the contents of the medium
* param.
@@ -1677,7 +1681,6 @@ mail_display_init (GtkObject *object)
{
MailDisplay *mail_display = MAIL_DISPLAY (object);
- mail_display->current_message = NULL;
mail_display->scroll = NULL;
mail_display->html = NULL;
mail_display->redisplay_counter = 0;
@@ -1703,6 +1706,9 @@ mail_display_destroy (GtkObject *object)
gtk_object_unref (GTK_OBJECT (mail_display->html));
+ if (mail_display->current_message)
+ camel_object_unref (mail_display->current_message);
+
g_free (mail_display->charset);
g_free (mail_display->selection);
g_free (mail_display->followup);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index c43d93a039..dd69f923a2 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -828,7 +828,7 @@ struct _append_msg {
CamelMessageInfo *info;
char *appended_uid;
- void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, char *appended_uid, void *data);
+ void (*done)(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, const char *appended_uid, void *data);
void *data;
};
@@ -1610,7 +1610,7 @@ struct _get_message_msg {
CamelFolder *folder;
char *uid;
- void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data);
+ void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data);
void *data;
CamelMimeMessage *message;
CamelOperation *cancel;
@@ -1641,10 +1641,13 @@ static void get_message_got(struct _mail_msg *mm)
static void get_message_free(struct _mail_msg *mm)
{
struct _get_message_msg *m = (struct _get_message_msg *)mm;
-
- g_free(m->uid);
- camel_object_unref((CamelObject *)m->folder);
- camel_operation_unref(m->cancel);
+
+ g_free (m->uid);
+ camel_object_unref (m->folder);
+ camel_operation_unref (m->cancel);
+
+ if (m->message)
+ camel_object_unref (m->message);
}
static struct _mail_msg_op get_message_op = {
@@ -1655,10 +1658,12 @@ static struct _mail_msg_op get_message_op = {
};
void
-mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data), void *data, EThread *thread)
+mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder *folder, const char *uid,
+ CamelMimeMessage *msg, void *data),
+ void *data, EThread *thread)
{
struct _get_message_msg *m;
-
+
m = mail_msg_new(&get_message_op, NULL, sizeof(*m));
m->folder = folder;
camel_object_ref((CamelObject *)folder);
@@ -1666,7 +1671,7 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder
m->data = data;
m->done = done;
m->cancel = camel_operation_new(NULL, NULL);
-
+
e_thread_put(thread, (EMsg *)m);
}
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index f471ea1c72..e509577bd6 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -52,7 +52,7 @@ void mail_transfer_messages (CamelFolder *source, GPtrArray *uids,
/* get a single message, asynchronously */
void mail_get_message (CamelFolder *folder, const char *uid,
- void (*done) (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data),
+ void (*done) (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data),
void *data,
EThread *thread);