diff --git a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs index 04baf7d854..eb35fa1d0f 100644 --- a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs @@ -83,7 +83,7 @@ namespace osu.Game.Tests.Editing.Checks private BeatmapVerifierContext getContext(string resourceName, bool allowMissing = false) { - Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); + using Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); if (!allowMissing && resourceStream == null) throw new FileNotFoundException($"The requested test resource \"{resourceName}\" does not exist."); diff --git a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs index e978af5e49..e95665156f 100644 --- a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs @@ -104,7 +104,7 @@ namespace osu.Game.Tests.Editing.Checks private BeatmapVerifierContext getContext(string resourceName, bool allowMissing = false) { - Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); + using Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName); if (!allowMissing && resourceStream == null) throw new FileNotFoundException($"The requested test resource \"{resourceName}\" does not exist."); diff --git a/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs b/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs index af87e52c62..fd742ba384 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckAudioInVideo.cs @@ -50,8 +50,12 @@ namespace osu.Game.Rulesets.Edit.Checks continue; } - Stream data = context.WorkingBeatmap.GetStream(storagePath); - StreamFileAbstraction fileAbstraction = new StreamFileAbstraction(filename, data); + StreamFileAbstraction fileAbstraction; + + using (Stream data = context.WorkingBeatmap.GetStream(storagePath)) + { + fileAbstraction = new StreamFileAbstraction(filename, data); + } // We use TagLib here for platform invariance; BASS cannot detect audio presence on Linux. TagLib.File tagFile = null; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs b/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs index 5c0969d29f..c3faf6edc1 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckTooShortAudioFiles.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Edit.Checks foreach (var file in beatmapSet.Files) { - Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath); + using Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath); if (data == null) continue; diff --git a/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs b/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs index 932d216d94..406ec013d7 100644 --- a/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs +++ b/osu.Game/Rulesets/Edit/Checks/CheckZeroByteFiles.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit.Checks foreach (var file in beatmapSet.Files) { - Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath); + using Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath); if (data?.Length == 0) yield return new IssueTemplateZeroBytes(this).Create(file.Filename); }