diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 175f4ff84..383256dcc 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1268,9 +1268,9 @@ namespace Flow.Launcher.ViewModel var isHomeQuery = query.RawQuery == string.Empty; - _updateSource?.Dispose(); // Dispose old update source to fix possible cancellation issue - _updateSource = new CancellationTokenSource(); + var oldSource = Interlocked.Exchange(ref _updateSource, new CancellationTokenSource()); _updateToken = _updateSource.Token; + oldSource?.Dispose(); // Dispose old update source to fix possible cancellation issue ProgressBarVisibility = Visibility.Hidden; _isQueryRunning = true;