[evolution] Bug 724039 - Message preview shows a wrong message
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 724039 - Message preview shows a wrong message
- Date: Fri, 12 Dec 2014 12:45:29 +0000 (UTC)
commit 2d83d7655f7b06eba77962f353b10c0f4f0d696a
Author: Milan Crha <mcrha redhat com>
Date: Fri Dec 12 13:34:20 2014 +0100
Bug 724039 - Message preview shows a wrong message
mail/e-mail-reader-utils.c | 37 ++++++++++++++++++++++++++++++++++---
mail/e-mail-reader-utils.h | 3 ++-
mail/e-mail-reader.c | 10 +++++++++-
3 files changed, 45 insertions(+), 5 deletions(-)
---
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index e8e6f80..65603cb 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1252,6 +1252,7 @@ mail_reader_print_parse_message_cb (GObject *source_object,
EMailPrinter *printer;
EMailPartList *part_list;
AsyncContext *async_context;
+ GError *local_error = NULL;
reader = E_MAIL_READER (source_object);
async_context = (AsyncContext *) user_data;
@@ -1259,7 +1260,17 @@ mail_reader_print_parse_message_cb (GObject *source_object,
activity = async_context->activity;
cancellable = e_activity_get_cancellable (activity);
- part_list = e_mail_reader_parse_message_finish (reader, result);
+ part_list = e_mail_reader_parse_message_finish (reader, result, &local_error);
+
+ if (local_error) {
+ g_warn_if_fail (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED));
+
+ e_activity_handle_cancellation (activity, local_error);
+ g_clear_error (&local_error);
+ async_context_free (async_context);
+
+ return;
+ }
printer = e_mail_printer_new (part_list);
@@ -1945,10 +1956,21 @@ mail_reader_reply_message_parsed (GObject *object,
EMsgComposer *composer;
CamelMimeMessage *message;
AsyncContext *async_context;
+ GError *local_error = NULL;
async_context = (AsyncContext *) user_data;
- part_list = e_mail_reader_parse_message_finish (reader, result);
+ part_list = e_mail_reader_parse_message_finish (reader, result, &local_error);
+
+ if (local_error) {
+ g_warn_if_fail (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED));
+
+ g_clear_error (&local_error);
+ async_context_free (async_context);
+
+ return;
+ }
+
message = e_mail_part_list_get_message (part_list);
backend = e_mail_reader_get_backend (async_context->reader);
@@ -2650,6 +2672,7 @@ mail_reader_parse_message_run (GSimpleAsyncResult *simple,
EMailPartList *part_list;
AsyncContext *async_context;
gchar *mail_uri;
+ GError *local_error = NULL;
async_context = g_simple_async_result_get_op_res_gpointer (simple);
@@ -2688,6 +2711,9 @@ mail_reader_parse_message_run (GSimpleAsyncResult *simple,
g_free (mail_uri);
async_context->part_list = part_list;
+
+ if (g_cancellable_set_error_if_cancelled (cancellable, &local_error))
+ g_simple_async_result_take_error (simple, local_error);
}
void
@@ -2737,7 +2763,8 @@ e_mail_reader_parse_message (EMailReader *reader,
EMailPartList *
e_mail_reader_parse_message_finish (EMailReader *reader,
- GAsyncResult *result)
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
AsyncContext *async_context;
@@ -2748,6 +2775,10 @@ e_mail_reader_parse_message_finish (EMailReader *reader,
e_mail_reader_parse_message), NULL);
simple = G_SIMPLE_ASYNC_RESULT (result);
+
+ if (g_simple_async_result_propagate_error (simple, error))
+ return NULL;
+
async_context = g_simple_async_result_get_op_res_gpointer (simple);
if (async_context->part_list != NULL)
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
index a1366f8..46c95be 100644
--- a/mail/e-mail-reader-utils.h
+++ b/mail/e-mail-reader-utils.h
@@ -101,7 +101,8 @@ void e_mail_reader_parse_message (EMailReader *reader,
gpointer user_data);
EMailPartList * e_mail_reader_parse_message_finish
(EMailReader *reader,
- GAsyncResult *result);
+ GAsyncResult *result,
+ GError **error);
G_END_DECLS
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 9eb2a81..5c738e5 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -3287,11 +3287,19 @@ set_mail_display_part_list (GObject *object,
EMailPartList *part_list;
EMailReader *reader;
EMailDisplay *display;
+ GError *local_error = NULL;
reader = E_MAIL_READER (object);
display = e_mail_reader_get_mail_display (reader);
- part_list = e_mail_reader_parse_message_finish (reader, result);
+ part_list = e_mail_reader_parse_message_finish (reader, result, &local_error);
+
+ if (local_error) {
+ g_warn_if_fail (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED));
+
+ g_clear_error (&local_error);
+ return;
+ }
e_mail_display_set_part_list (display, part_list);
e_mail_display_load (display, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]