Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hez2010 committed Sep 3, 2021
1 parent 37433fe commit 23cb6e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion Files/Helpers/AsyncManualResetEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public Task<bool> WaitAsync(int milliseconds, CancellationToken cancellationToke
cancellationToken.Register(
s => ((TaskCompletionSource<bool>)s).TrySetCanceled(), tcs);


return Task.WhenAny(m_tcs.Task, Delay(milliseconds)).Result;
}

Expand Down
6 changes: 4 additions & 2 deletions Files/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,13 @@ public async Task LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
item.ItemPropertiesInitialized = true;
itemLoadQueue[item.ItemPath] = false;

var cts = loadPropsCTS;

try
{
await Task.Run(async () =>
{
await loadPropsEvent.WaitAsync(loadPropsCTS.Token);
await loadPropsEvent.WaitAsync(cts.Token);

if (itemLoadQueue.TryGetValue(item.ItemPath, out var canceled) && canceled)
{
Expand Down Expand Up @@ -1039,7 +1041,7 @@ await FilesystemTasks.Wrap(() => CoreApplication.MainView.DispatcherQueue.Enqueu
}));
}
}
}, loadPropsCTS.Token);
}, cts.Token);
}
catch (OperationCanceledException)
{
Expand Down

0 comments on commit 23cb6e4

Please sign in to comment.