Skip to content

Commit 824b7ba

Browse files
authored
Merge pull request #1040 from oSumAtrIX/race-condition-fix
Remove calling `.ToArray()` on a `ConcurrentDictionary`
2 parents 16e032e + 4e3d713 commit 824b7ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Flow.Launcher.Infrastructure/Image/ImageCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async void SliceExtra()
7474
// To delete the images from the data dictionary based on the resizing of the Usage Dictionary
7575
// Double Check to avoid concurrent remove
7676
if (Data.Count > permissibleFactor * MaxCached)
77-
foreach (var key in Data.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key).ToArray())
77+
foreach (var key in Data.OrderBy(x => x.Value.usage).Take(Data.Count - MaxCached).Select(x => x.Key))
7878
Data.TryRemove(key, out _);
7979
semaphore.Release();
8080
}

0 commit comments

Comments
 (0)