mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
optimize<*>: use custom view locator instead of ContentControl.DataTemplates to avoid memory leak.
This commit is contained in:
parent
27d4dd5f64
commit
60e664ab26
9 changed files with 77 additions and 62 deletions
|
@ -160,26 +160,23 @@ namespace SourceGit.ViewModels {
|
|||
} else {
|
||||
page = ActivePage;
|
||||
page.Node = node;
|
||||
page.View = new Views.Repository() { DataContext = repo };
|
||||
page.Data = repo;
|
||||
}
|
||||
} else {
|
||||
page.Node = node;
|
||||
page.View = new Views.Repository() { DataContext = repo };
|
||||
page.Data = repo;
|
||||
}
|
||||
|
||||
ActivePage = page;
|
||||
}
|
||||
|
||||
private void CloseRepositoryInTab(LauncherPage page) {
|
||||
if (page.Node.IsRepository) {
|
||||
var repo = Preference.FindRepository(page.Node.Id);
|
||||
if (repo != null) {
|
||||
Commands.AutoFetch.RemoveRepository(repo.FullPath);
|
||||
repo.Close();
|
||||
}
|
||||
if (page.Data is Repository repo) {
|
||||
Commands.AutoFetch.RemoveRepository(repo.FullPath);
|
||||
repo.Close();
|
||||
}
|
||||
|
||||
page.View = null;
|
||||
page.Data = null;
|
||||
}
|
||||
|
||||
private LauncherPage _activePage = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue