From 178c3b5406d2d3631e3d55611143152f8437a0ac Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Wed, 11 Jul 2007 12:43:35 +0000 Subject: [PATCH] * src/modest-ui-actions.c: * Removed annoying warning for check retrieval in message open handler. THis was appearing everytime we cancelled a message retrieval. * src/modest-mail-operation.c: * Now we notify the end of the mail operation before unreferencing. This prevents a crash. * Now we do a tny_account_cancel in status handler when we get a cancel status. This way we properly cancel the message download (and then we can try again to open the message as expected (fixes NB#62444). pmo-trunk-r2696 --- src/modest-mail-operation.c | 20 ++++++++++++++++---- src/modest-ui-actions.c | 2 -- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index b21a831..26c8c94 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -1962,13 +1962,13 @@ get_msg_cb (TnyFolder *folder, gdk_threads_leave (); } + /* Notify about operation end */ + modest_mail_operation_notify_end (self); /* Free */ g_object_unref (helper->mail_op); g_object_unref (helper->header); g_slice_free (GetMsgAsyncHelper, helper); - /* Notify about operation end */ - modest_mail_operation_notify_end (self); } static void @@ -1990,8 +1990,20 @@ get_msg_status_cb (GObject *obj, self = helper->mail_op; priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self); - if(priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) + if(priv->status == MODEST_MAIL_OPERATION_STATUS_CANCELED) { + TnyFolder *folder = tny_header_get_folder (helper->header); + if (folder) { + TnyAccount *account; + account = tny_folder_get_account (folder); + if (account) { + tny_account_cancel (account); + g_object_unref (account); + } + g_object_unref (folder); + } + return; + } priv->done = 1; priv->total = 1; @@ -2118,7 +2130,7 @@ get_msgs_full_thread (gpointer thr_user_data) info_notify, NULL); } g_object_unref (msg); - } + } } else { /* Set status failed and set an error */ priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED; diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 14a7f28..bfd986d 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -701,8 +701,6 @@ open_msg_cb (ModestMailOperation *mail_op, operation. The error will be shown by the error_handler of the mail operation */ if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) { - printf ("DEBUG: %s: modest_ui_actions_msg_retrieval_check() failed.\n", - __FUNCTION__); return; } -- 1.7.9.5