Skip to content

Commit a362883

Browse files
committed
Fix itemPropertiesInitialized visibility
1 parent c6ca824 commit a362883

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Files/Filesystem/ListedItem.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.Collections.ObjectModel;
1414
using System.IO;
1515
using System.Linq;
16+
using System.Threading;
1617
using Windows.Storage;
1718
using Windows.UI.Xaml.Media.Imaging;
1819

@@ -22,7 +23,16 @@ public class ListedItem : ObservableObject, IGroupableItem
2223
{
2324
public bool IsHiddenItem { get; set; } = false;
2425
public StorageItemTypes PrimaryItemAttribute { get; set; }
25-
public bool ItemPropertiesInitialized { get; set; } = false;
26+
27+
private volatile int itemPropertiesInitialized = 0;
28+
public bool ItemPropertiesInitialized
29+
{
30+
get => itemPropertiesInitialized == 1;
31+
set
32+
{
33+
Interlocked.Exchange(ref itemPropertiesInitialized, value ? 1 : 0);
34+
}
35+
}
2636

2737
public string ItemTooltipText
2838
{

Files/ViewModels/ItemViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -915,13 +915,13 @@ public async Task LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
915915
await Task.Run(async () =>
916916
{
917917
await itemLoadEvent.WaitAsync(cts.Token);
918-
item.ItemPropertiesInitialized = true;
919918

920919
if (itemLoadQueue.TryGetValue(item.ItemPath, out var canceled) && canceled)
921920
{
922921
return;
923922
}
924923

924+
item.ItemPropertiesInitialized = true;
925925
var wasSyncStatusLoaded = false;
926926
ImageSource groupImage = null;
927927
bool loadGroupHeaderInfo = false;

0 commit comments

Comments
 (0)