From cc3d46f78cdc1233a0ae9b8f2d021348e1e77aee Mon Sep 17 00:00:00 2001 From: Jaap-Jan de Wit | DodoTech Date: Fri, 2 Oct 2026 14:10:40 +0200 Subject: [PATCH] Transfers: let cancel pressed as a transfer finishes do nothing rather than throw --- src/DodoSSH.Client.Transfer/FileTransferQueue.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/DodoSSH.Client.Transfer/FileTransferQueue.cs b/src/DodoSSH.Client.Transfer/FileTransferQueue.cs index 69a624f..9fb0476 100644 --- a/src/DodoSSH.Client.Transfer/FileTransferQueue.cs +++ b/src/DodoSSH.Client.Transfer/FileTransferQueue.cs @@ -338,7 +338,16 @@ public sealed class FileTransferQueue : IAsyncDisposable } } - running?.Cancel(); + // Outside the gate, because cancelling runs the token's callbacks on this thread — but that leaves a + // moment in which the run finishes and disposes the source it was read from. A disposed source is a + // transfer that is already over, so there is nothing left to cancel and nothing to report. + try + { + running?.Cancel(); + } + catch (ObjectDisposedException) + { + } if (cancelled is not null) {