Skip to content

Commit 32b75b4

Browse files
committed
Fix CancellationTokenSource dispose state
1 parent f2a7536 commit 32b75b4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,12 @@ public static string GetFolderSize(string folderPath)
150150
{
151151
var directoryInfo = new DirectoryInfo(folderPath);
152152
long size = 0;
153-
var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(3));
153+
using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(3));
154154
foreach (var file in directoryInfo.EnumerateFiles("*", SearchOption.AllDirectories))
155155
{
156156
if (cancellationTokenSource.Token.IsCancellationRequested)
157157
{
158158
// Timeout occurred, return unknown size
159-
cancellationTokenSource.Dispose();
160159
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
161160
}
162161
size += file.Length;

0 commit comments

Comments
 (0)