|
12 | 12 |
|
13 | 13 | namespace SourceGit.ViewModels
|
14 | 14 | {
|
15 |
| - public class Histories : ObservableObject |
| 15 | + public class Histories : ObservableObject, IDisposable |
16 | 16 | {
|
17 | 17 | public Repository Repo
|
18 | 18 | {
|
@@ -57,7 +57,7 @@ public long NavigationId
|
57 | 57 | private set => SetProperty(ref _navigationId, value);
|
58 | 58 | }
|
59 | 59 |
|
60 |
| - public object DetailContext |
| 60 | + public IDisposable DetailContext |
61 | 61 | {
|
62 | 62 | get => _detailContext;
|
63 | 63 | set => SetProperty(ref _detailContext, value);
|
@@ -98,23 +98,13 @@ public Histories(Repository repo)
|
98 | 98 | _repo = repo;
|
99 | 99 | }
|
100 | 100 |
|
101 |
| - public void Cleanup() |
| 101 | + public void Dispose() |
102 | 102 | {
|
103 |
| - Commits = new List<Models.Commit>(); |
104 |
| - |
| 103 | + Commits = []; |
105 | 104 | _repo = null;
|
106 | 105 | _graph = null;
|
107 | 106 | _autoSelectedCommit = null;
|
108 |
| - |
109 |
| - if (_detailContext is CommitDetail cd) |
110 |
| - { |
111 |
| - cd.Cleanup(); |
112 |
| - } |
113 |
| - else if (_detailContext is RevisionCompare rc) |
114 |
| - { |
115 |
| - rc.Cleanup(); |
116 |
| - } |
117 |
| - |
| 107 | + _detailContext?.Dispose(); |
118 | 108 | _detailContext = null;
|
119 | 109 | }
|
120 | 110 |
|
@@ -220,7 +210,7 @@ public void Select(IList commits)
|
220 | 210 | else
|
221 | 211 | {
|
222 | 212 | _repo.SelectedSearchedCommit = null;
|
223 |
| - DetailContext = commits.Count; |
| 213 | + DetailContext = new Models.Count(commits.Count); |
224 | 214 | }
|
225 | 215 | }
|
226 | 216 |
|
@@ -1256,7 +1246,7 @@ private string GetPatchFileName(string dir, Models.Commit commit, int index = 0)
|
1256 | 1246 | private Models.CommitGraph _graph = null;
|
1257 | 1247 | private Models.Commit _autoSelectedCommit = null;
|
1258 | 1248 | private long _navigationId = 0;
|
1259 |
| - private object _detailContext = null; |
| 1249 | + private IDisposable _detailContext = null; |
1260 | 1250 |
|
1261 | 1251 | private Models.Bisect _bisect = null;
|
1262 | 1252 |
|
|
0 commit comments