optimize<*>: reduce memory usage

This commit is contained in:
leo 2024-02-20 18:27:59 +08:00
parent ca19d65f0e
commit 57c4a8394c
8 changed files with 99 additions and 16 deletions

View file

@ -56,6 +56,22 @@ namespace SourceGit.ViewModels {
_repo = repo;
}
public void Cleanup() {
Commits = new List<Models.Commit>();
_repo = null;
_graph = null;
_autoSelectedCommit = null;
if (_detailContext is CommitDetail cd) {
cd.Cleanup();
} else if (_detailContext is RevisionCompare rc) {
rc.Cleanup();
}
_detailContext = null;
}
public void NavigateTo(string commitSHA) {
var commit = _commits.Find(x => x.SHA.StartsWith(commitSHA));
if (commit != null) {