Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fixed crash that would occur when deleting or restoring files #13195

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/Files.App/Data/Items/LocationItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public bool IsExpanded
public bool IsHeader { get; set; }

private object toolTip = "";
public object ToolTip
public virtual object ToolTip
{
get => toolTip;
set
Expand All @@ -109,7 +109,10 @@ public class RecycleBinLocationItem : LocationItem
{
public void RefreshSpaceUsed(object sender, FileSystemEventArgs e)
{
SpaceUsed = RecycleBinHelpers.GetSize();
MainWindow.Instance.DispatcherQueue.TryEnqueue(() =>
{
SpaceUsed = RecycleBinHelpers.GetSize();
});
}

private ulong spaceUsed;
Expand All @@ -118,10 +121,16 @@ public ulong SpaceUsed
get => spaceUsed;
set
{
SetProperty(ref spaceUsed, value);
if (SetProperty(ref spaceUsed, value))
OnPropertyChanged(nameof(ToolTip));
}
}

public override object ToolTip
{
get => SpaceUsed.ToSizeString();
}

public RecycleBinLocationItem()
{
SpaceUsed = RecycleBinHelpers.GetSize();
Expand Down
5 changes: 0 additions & 5 deletions src/Files.App/Data/Models/SidebarPinnedModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ public async Task<LocationItem> CreateLocationItemFromPathAsync(string path)
locationItem.IsDefaultLocation = false;
locationItem.Text = res.Result?.DisplayName ?? Path.GetFileName(path.TrimEnd('\\'));

if(locationItem is RecycleBinLocationItem recycleBinItem)
{
recycleBinItem.ToolTip = recycleBinItem.SpaceUsed.ToSizeString();
}

if (res || (FilesystemResult)FolderHelpers.CheckFolderAccessWithWin32(path))
{
locationItem.IsInvalid = false;
Expand Down