From a4c3ad01a731af706cd03bfbc03cc52f08459b67 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:49:33 +0900 Subject: [PATCH] Update NavigationInteractionTracker.cs --- .../Views/NavigationInteractionTracker.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Files.App/Views/NavigationInteractionTracker.cs b/src/Files.App/Views/NavigationInteractionTracker.cs index 217c35611b09..b4fe61cea291 100644 --- a/src/Files.App/Views/NavigationInteractionTracker.cs +++ b/src/Files.App/Views/NavigationInteractionTracker.cs @@ -23,8 +23,11 @@ public bool CanNavigateForward } set { - _props.InsertBoolean(nameof(CanNavigateForward), value); - _tracker.MaxPosition = new(value ? 96f : 0f); + if (!_disposed) + { + _props.InsertBoolean(nameof(CanNavigateForward), value); + _tracker.MaxPosition = new(value ? 96f : 0f); + } } } @@ -37,8 +40,11 @@ public bool CanNavigateBackward } set { - _props.InsertBoolean(nameof(CanNavigateBackward), value); - _tracker.MinPosition = new(value ? -96f : 0f); + if (!_disposed) + { + _props.InsertBoolean(nameof(CanNavigateBackward), value); + _tracker.MinPosition = new(value ? -96f : 0f); + } } } @@ -157,6 +163,8 @@ public void Dispose() if (_disposed) return; + _disposed = true; + _rootElement.RemoveHandler(UIElement.PointerPressedEvent, _pointerPressedHandler); _backVisual.StopAnimation("Translation.X"); _forwardVisual.StopAnimation("Translation.X"); @@ -164,7 +172,6 @@ public void Dispose() _source.Dispose(); _props.Dispose(); - _disposed = true; GC.SuppressFinalize(this); }