Fixed VM disposal issues

This commit is contained in:
Robert committed 2023-05-12 23:27:27 +02:00
1 parent 5adc837673
commit e783dcaa58
8 files changed
+17 -36

No files matched your search

@@ -22,7 +22,6 @@ namespace Artemis.UI.Screens.ProfileEditor;
public class ProfileEditorViewModel : MainScreenViewModel
{
private readonly IMainWindowService _mainWindowService;
private readonly IProfileEditorService _profileEditorService;
private readonly ISettingsService _settingsService;
private readonly SourceList<IToolViewModel> _tools;
@@ -51,7 +50,6 @@ public class ProfileEditorViewModel : MainScreenViewModel
{
_profileEditorService = profileEditorService;
_settingsService = settingsService;
_mainWindowService = mainWindowService;
_tools = new SourceList<IToolViewModel>();
_tools.AddRange(toolViewModels);
@@ -77,6 +75,8 @@ public class ProfileEditorViewModel : MainScreenViewModel
{
mainWindowService.MainWindowFocused -= MainWindowServiceOnMainWindowFocused;
mainWindowService.MainWindowUnfocused -= MainWindowServiceOnMainWindowUnfocused;
foreach (IToolViewModel toolViewModel in _tools.Items)
toolViewModel.Dispose();
}).DisposeWith(d);
// Slow and steady wins the race (and doesn't lock up the entire UI)