mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Add missing realm subscription cleanup
This commit is contained in:
@ -20,13 +20,15 @@ namespace osu.Game.Collections
|
||||
/// </summary>
|
||||
public class DrawableCollectionList : OsuRearrangeableListContainer<Live<BeatmapCollection>>
|
||||
{
|
||||
private Scroll scroll = null!;
|
||||
|
||||
protected override ScrollContainer<Drawable> CreateScrollContainer() => scroll = new Scroll();
|
||||
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; } = null!;
|
||||
|
||||
private Scroll scroll = null!;
|
||||
|
||||
private IDisposable? realmSubscription;
|
||||
|
||||
protected override FillFlowContainer<RearrangeableListItem<Live<BeatmapCollection>>> CreateListFillFlowContainer() => new Flow
|
||||
{
|
||||
DragActive = { BindTarget = DragActive }
|
||||
@ -36,7 +38,7 @@ namespace osu.Game.Collections
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
realm.RegisterForNotifications(r => r.All<BeatmapCollection>(), collectionsChanged);
|
||||
realmSubscription = realm.RegisterForNotifications(r => r.All<BeatmapCollection>(), collectionsChanged);
|
||||
}
|
||||
|
||||
private void collectionsChanged(IRealmCollection<BeatmapCollection> collections, ChangeSet? changes, Exception error)
|
||||
@ -53,6 +55,12 @@ namespace osu.Game.Collections
|
||||
return new DrawableCollectionListItem(item, true);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
realmSubscription?.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The scroll container for this <see cref="DrawableCollectionList"/>.
|
||||
/// Contains the main flow of <see cref="DrawableCollectionListItem"/> and attaches a placeholder item to the end of the list.
|
||||
|
Reference in New Issue
Block a user