From a8c98320eac2c32a0427101113a3b9f134290771 Mon Sep 17 00:00:00 2001 From: Felipe Erias Morandeira Date: Fri, 14 Dec 2007 12:30:42 +0000 Subject: [PATCH] Corrected ref and unref of mail operations. pmo-trunk-r3918 --- src/maemo/modest-main-window.c | 8 ++++++-- src/maemo/modest-msg-view-window.c | 1 + src/modest-mail-operation-queue.c | 3 ++- src/widgets/modest-window-mgr.c | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index e827044..60ebdf6 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -2216,8 +2216,12 @@ on_mail_operation_started (ModestMailOperation *mail_op, /* Add operation observers and change toolbar if neccessary*/ tmp = priv->progress_widgets; if (mode == TOOLBAR_MODE_TRANSFER) { - if (mode_changed && (G_OBJECT (self) == modest_mail_operation_get_source(mail_op))) - set_toolbar_transfer_mode(self); + if (mode_changed) { + if (G_OBJECT (self) == modest_mail_operation_get_source(mail_op)) { + set_toolbar_transfer_mode(self); + } + g_object_unref (G_OBJECT (mail_op)); + } while (tmp) { modest_progress_object_add_operation (MODEST_PROGRESS_OBJECT (tmp->data), diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 7246417..85e3c5d 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -2195,6 +2195,7 @@ on_mail_operation_started (ModestMailOperation *mail_op, } } } + g_object_unref (G_OBJECT (mail_op)); } static void diff --git a/src/modest-mail-operation-queue.c b/src/modest-mail-operation-queue.c index 19cb4ed..a05c8fd 100644 --- a/src/modest-mail-operation-queue.c +++ b/src/modest-mail-operation-queue.c @@ -385,7 +385,8 @@ on_find_by_source_foreach (gpointer op, gpointer data) FindBySourceInfo *info = (FindBySourceInfo*) data; if ( info->source == modest_mail_operation_get_source (MODEST_MAIL_OPERATION (op))) { - *(info->new_list) = g_slist_prepend (*(info->new_list), MODEST_MAIL_OPERATION (op)); + g_object_ref (G_OBJECT (op)); + *(info->new_list) = g_slist_prepend (*(info->new_list), MODEST_MAIL_OPERATION (op)); } } diff --git a/src/widgets/modest-window-mgr.c b/src/widgets/modest-window-mgr.c index 80731e7..6d03595 100644 --- a/src/widgets/modest-window-mgr.c +++ b/src/widgets/modest-window-mgr.c @@ -796,6 +796,7 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self, if (type == MODEST_MAIL_OPERATION_TYPE_RECEIVE || type == MODEST_MAIL_OPERATION_TYPE_OPEN) { modest_mail_operation_cancel (pending_ops->data); } + g_object_unref (G_OBJECT (pending_ops->data)); tmp_list = pending_ops; pending_ops = g_slist_next (pending_ops); g_slist_free_1 (tmp_list); -- 1.7.9.5