From 79715fe37b3ac24ce30e1dd50e441c67adc27e5e Mon Sep 17 00:00:00 2001 From: cdwcgt Date: Sun, 19 Feb 2023 02:24:07 +0900 Subject: [PATCH] catch when zipWriter dispose ObjectDisposedException also appear when zipwriter dispose after user request cancel --- osu.Game/Database/LegacyArchiveExporter.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/LegacyArchiveExporter.cs b/osu.Game/Database/LegacyArchiveExporter.cs index 24a5d52f73..fd2befd2e0 100644 --- a/osu.Game/Database/LegacyArchiveExporter.cs +++ b/osu.Game/Database/LegacyArchiveExporter.cs @@ -35,13 +35,13 @@ protected override void ExportToStream(TModel model, Stream outputStream, Progre /// The Cancellation token that can cancel the exporting. private void exportZipArchive(TModel model, Stream outputStream, ProgressNotification notification, CancellationToken cancellationToken = default) { - using var writer = new ZipWriter(outputStream, new ZipWriterOptions(CompressionType.Deflate)); - - float i = 0; - bool fileMissing = false; - try { + var writer = new ZipWriter(outputStream, new ZipWriterOptions(CompressionType.Deflate)); + + float i = 0; + bool fileMissing = false; + foreach (var file in model.Files) { cancellationToken.ThrowIfCancellationRequested();