Skip to content

Commit

Permalink
Prevent twice entrance
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Sep 3, 2021
1 parent e579722 commit 2dcd11a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Files/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,11 @@ public async Task LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
return;
}

item.ItemPropertiesInitialized = true;
if (itemLoadQueue.ContainsKey(item.ItemPath))
{
return;
}

itemLoadQueue[item.ItemPath] = false;

var cts = loadPropsCTS;
Expand All @@ -916,6 +920,7 @@ public async Task LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
await Task.Run(async () =>
{
await itemLoadEvent.WaitAsync(cts.Token);
item.ItemPropertiesInitialized = true;

if (itemLoadQueue.TryGetValue(item.ItemPath, out var canceled) && canceled)
{
Expand Down Expand Up @@ -1045,7 +1050,7 @@ await FilesystemTasks.Wrap(() => CoreApplication.MainView.DispatcherQueue.Enqueu
}
catch (OperationCanceledException)
{
item.ItemPropertiesInitialized = false;
// ignored
}
finally
{
Expand Down

0 comments on commit 2dcd11a

Please sign in to comment.