Fixed memory leak issue with song image source not getting disposed. Added playbackbar configuration button.
This commit is contained in:
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Harmonia.UI.ViewModels;
|
||||
|
||||
public class PlayingSongInfoViewModel : ViewModelBase
|
||||
public class PlayingSongInfoViewModel : ViewModelBase, IDisposable
|
||||
{
|
||||
private readonly IAudioPlayer _audioPlayer;
|
||||
private readonly IAudioImageCache _audioImageCache;
|
||||
@@ -41,6 +41,7 @@ public class PlayingSongInfoViewModel : ViewModelBase
|
||||
}
|
||||
private set
|
||||
{
|
||||
_songImageSource?.Dispose();
|
||||
_songImageSource = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
@@ -88,4 +89,10 @@ public class PlayingSongInfoViewModel : ViewModelBase
|
||||
using MemoryStream stream = new(songPictureInfo.Data);
|
||||
SongImageSource = new(stream);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
SongImageSource?.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user