Skip to content

Commit 95e6420

Browse files
committed
Dispose things properly
1 parent e31820d commit 95e6420

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/NexusMods.App.UI/Controls/TreeDataGrid/TreeDataGridAdapter.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using NexusMods.App.UI.Extensions;
88
using ObservableCollections;
99
using R3;
10+
using System.Reactive.Linq;
1011

1112
namespace NexusMods.App.UI.Controls;
1213

@@ -99,8 +100,9 @@ protected TreeDataGridAdapter()
99100
return self
100101
.GetRootsObservable(viewHierarchical)
101102
.OnUI()
103+
.Do(changeSet => self.Roots.ApplyChanges(changeSet))
104+
.DisposeMany()
102105
.ToObservable()
103-
.Do(self, static (changeSet, self) => self.Roots.ApplyChanges(changeSet))
104106
.Select(viewHierarchical, static (_, viewHierarchical) => viewHierarchical);
105107
})
106108
.Switch()
@@ -118,7 +120,7 @@ private static (ITreeDataGridSelection, Observable<TreeSelectionModelSelectionCh
118120
SingleSelect = false,
119121
};
120122

121-
var selectionObservable = Observable.FromEventHandler<TreeSelectionModelSelectionChangedEventArgs<TModel>>(
123+
var selectionObservable = R3.Observable.FromEventHandler<TreeSelectionModelSelectionChangedEventArgs<TModel>>(
122124
addHandler: handler => selection.SelectionChanged += handler,
123125
removeHandler: handler => selection.SelectionChanged -= handler
124126
).Select(tuple => tuple.e);

src/NexusMods.App.UI/Pages/LibraryPage/NexusModsModPageLibraryItemModel.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public NexusModsModPageLibraryItemModel(IObservable<IChangeSet<NexusModsLibraryI
120120
FormattedInstalledDate,
121121
InstallItemCommand,
122122
IsInstalled,
123-
InstallButtonText
123+
InstallButtonText,
124+
linkedLoadoutItemsDisposable
124125
);
125126
}
126127

0 commit comments

Comments
 (0)