X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-window-mgr.c;h=80731e738ccc9080cafeb02311e0663a33d1a237;hb=f19d5b6e2df7fb9cea5db37287802d1245a7b796;hp=536b2306f9aa1d838ea576372bfa6df07ea158a1;hpb=01583e1fe0d3f591eef4b65573eb7b720e72edf8;p=modest diff --git a/src/widgets/modest-window-mgr.c b/src/widgets/modest-window-mgr.c index 536b230..80731e7 100644 --- a/src/widgets/modest-window-mgr.c +++ b/src/widgets/modest-window-mgr.c @@ -783,6 +783,25 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self, handler_id = *tmp; g_hash_table_remove (priv->destroy_handlers, window); + /* cancel open and receive operations */ + if (MODEST_IS_MSG_VIEW_WINDOW (window)) { + 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); + } + 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 */ g_signal_handler_disconnect (window, handler_id);