Skip to content

Commit

Permalink
Fix: Fixed ObjectDisposedException (#13671)
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu authored Nov 6, 2023
1 parent 83fd839 commit 1e4a04c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Files.App/Views/NavigationInteractionTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand All @@ -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);
}
}
}

Expand Down Expand Up @@ -157,14 +163,15 @@ public void Dispose()
if (_disposed)
return;

_disposed = true;

_rootElement.RemoveHandler(UIElement.PointerPressedEvent, _pointerPressedHandler);
_backVisual.StopAnimation("Translation.X");
_forwardVisual.StopAnimation("Translation.X");
_tracker.Dispose();
_source.Dispose();
_props.Dispose();

_disposed = true;
GC.SuppressFinalize(this);
}

Expand Down

0 comments on commit 1e4a04c

Please sign in to comment.