+ priv->op_id = 0;
+}
+
+static void
+on_finalize_foreach(gpointer op,
+ gpointer user_data)
+{
+ ModestMailOperationQueue *queue;
+ ModestMailOperationQueuePrivate *priv;
+ ModestMailOperation *mail_op;
+
+ queue = MODEST_MAIL_OPERATION_QUEUE (user_data);
+ priv = MODEST_MAIL_OPERATION_QUEUE_GET_PRIVATE (queue);
+ mail_op = MODEST_MAIL_OPERATION (op);
+
+ /* Simply remove from queue, but without emitting a
+ * QUEUE_CHANGED_SIGNAL because we are in finalize anyway and have
+ * the lock acquired. */
+ g_signal_handlers_disconnect_by_func (mail_op, G_CALLBACK (on_progress_changed), user_data);
+
+ modest_mail_operation_cancel (mail_op);
+ g_queue_remove (priv->op_queue, mail_op);
+ g_object_unref (G_OBJECT (mail_op));