From e51c131fd7e26652cd763366d62efc1714aa0d8c Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Fri, 19 May 2023 09:27:25 -0400 Subject: [PATCH] Dispose stuff --- src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs | 4 +++- src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs | 4 +++- src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml | 2 +- src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs | 2 +- src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs index d9c80cb2e..c122b0167 100644 --- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs +++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs @@ -1,3 +1,4 @@ +using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Input; @@ -182,8 +183,9 @@ namespace Ryujinx.Ava.UI.Views.Input return assigner; } - public void Dispose() + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) { + base.OnDetachedFromVisualTree(e); _currentAssigner?.Cancel(); _currentAssigner = null; } diff --git a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs index 04e76bb32..14f9176e0 100644 --- a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs +++ b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs @@ -1,3 +1,4 @@ +using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Input; @@ -198,8 +199,9 @@ namespace Ryujinx.Ava.UI.Views.Input return assigner; } - public void Dispose() + protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) { + base.OnDetachedFromVisualTree(e); _currentAssigner?.Cancel(); _currentAssigner = null; } diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml index 08b45f206..55c2ed6e3 100644 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml +++ b/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml @@ -29,7 +29,7 @@ + Name="InputView" /> diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs index e75c9f0cc..55b69af06 100644 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs +++ b/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Ava.UI.Views.Settings public void Dispose() { - ControllerSettings.Dispose(); + InputView.Dispose(); } } } diff --git a/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs index d7bb0b883..314501c52 100644 --- a/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs +++ b/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs @@ -37,7 +37,7 @@ namespace Ryujinx.Ava.UI.Windows public void SaveSettings() { - InputPage.ControllerSettings?.SaveCurrentProfile(); + InputPage.InputView?.SaveCurrentProfile(); if (Owner is MainWindow window && ViewModel.DirectoryChanged) {