From 32b75b4a4fcbc1039be92d55535049e0b0eaa05b Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Wed, 4 Jun 2025 17:44:24 +0800 Subject: [PATCH] Fix CancellationTokenSource dispose state --- .../Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs index 80c99ab9f..a3a0ad0aa 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/PreviewPanel.xaml.cs @@ -150,13 +150,12 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged { var directoryInfo = new DirectoryInfo(folderPath); long size = 0; - var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(3)); + using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(3)); foreach (var file in directoryInfo.EnumerateFiles("*", SearchOption.AllDirectories)) { if (cancellationTokenSource.Token.IsCancellationRequested) { // Timeout occurred, return unknown size - cancellationTokenSource.Dispose(); return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown"); } size += file.Length;