From bc6021dfa7dcb0ab05501c36fc170836d3d42cad Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Mon, 31 Mar 2008 11:56:42 +0000 Subject: [PATCH] * Fixes NB#82400, cancel retrieve operations in the main window when this last one is closed to prevent hangs when restarting the application pmo-trunk-r4356 --- src/widgets/modest-window-mgr.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/widgets/modest-window-mgr.c b/src/widgets/modest-window-mgr.c index 4d32a10..b0202f0 100644 --- a/src/widgets/modest-window-mgr.c +++ b/src/widgets/modest-window-mgr.c @@ -740,6 +740,7 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self, GList *win; ModestWindowMgrPrivate *priv; gulong *tmp, handler_id; + GSList* pending_ops = NULL; g_return_if_fail (MODEST_IS_WINDOW_MGR (self)); g_return_if_fail (MODEST_IS_WINDOW (window)); @@ -790,23 +791,20 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self, g_hash_table_remove (priv->destroy_handlers, window); /* cancel open and receive operations */ - if (MODEST_IS_MSG_VIEW_WINDOW (window)) { + pending_ops = modest_mail_operation_queue_get_by_source (modest_runtime_get_mail_operation_queue (), + G_OBJECT (window)); + while (pending_ops != NULL) { ModestMailOperationTypeOperation type; - GSList* pending_ops = NULL; GSList* tmp_list = NULL; - pending_ops = modest_mail_operation_queue_get_by_source ( - modest_runtime_get_mail_operation_queue (), - G_OBJECT (window)); - while (pending_ops != NULL) { - type = modest_mail_operation_get_type_operation (MODEST_MAIL_OPERATION (pending_ops->data)); - 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); + + type = modest_mail_operation_get_type_operation (MODEST_MAIL_OPERATION (pending_ops->data)); + 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); } /* Disconnect the "delete-event" handler, we won't need it anymore */ -- 1.7.9.5