From aab2df170497ee59e534603a865e60a74839800a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 Apr 2025 15:52:55 +0900 Subject: [PATCH] Fix missing disposal of `TagLib.File` in `ChangeAudioTrack` --- osu.Game/Screens/Edit/Setup/ResourcesSection.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 5399f1fd6f..b3c80d8daa 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -10,9 +10,9 @@ using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Game.Beatmaps; -using osu.Game.Overlays; using osu.Game.Localisation; using osu.Game.Models; +using osu.Game.Overlays; using osu.Game.Screens.Backgrounds; using osu.Game.Utils; @@ -98,11 +98,16 @@ namespace osu.Game.Screens.Edit.Setup if (!source.Exists) return false; - TagLib.File? tagSource; + string artist; + string title; try { - tagSource = TagLibUtils.GetTagLibFile(source.FullName); + using (var tagSource = TagLibUtils.GetTagLibFile(source.FullName)) + { + artist = tagSource.Tag.JoinedAlbumArtists; + title = tagSource.Tag.Title; + } } catch (Exception e) { @@ -116,16 +121,12 @@ namespace osu.Game.Screens.Edit.Setup { metadata.AudioFile = name; - string artist = tagSource.Tag.JoinedAlbumArtists; - if (!string.IsNullOrWhiteSpace(artist)) { metadata.ArtistUnicode = artist; metadata.Artist = MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode); } - string title = tagSource.Tag.Title; - if (!string.IsNullOrEmpty(title)) { metadata.TitleUnicode = title;