mirror of
https://github.com/ppy/osu.git
synced 2026-05-13 19:54:15 +08:00
Fix missing disposal of TagLib.File in ChangeAudioTrack
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user