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) {