diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 0a1ef8d81..f71674774 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -469,9 +469,9 @@ namespace Flow.Launcher.ViewModel
}
else
{
+ _updateSource?.Cancel();
Results.Clear();
Results.Visbility = Visibility.Collapsed;
-
}
}
@@ -695,7 +695,9 @@ namespace Flow.Launcher.ViewModel
_saved = true;
}
}
-
+ ///
+ /// To avoid deadlock, this method should not called from main thread
+ ///
public void UpdateResultView(IEnumerable resultsForUpdates)
{
foreach (var result in resultsForUpdates.SelectMany(u => u.Results))
diff --git a/Flow.Launcher/ViewModel/ResultsViewModel.cs b/Flow.Launcher/ViewModel/ResultsViewModel.cs
index d06a390c5..635b20ec6 100644
--- a/Flow.Launcher/ViewModel/ResultsViewModel.cs
+++ b/Flow.Launcher/ViewModel/ResultsViewModel.cs
@@ -174,7 +174,6 @@ namespace Flow.Launcher.ViewModel
Margin = new Thickness { Top = 0 };
Visbility = Visibility.Collapsed;
break;
-
}
}
@@ -247,7 +246,7 @@ namespace Flow.Launcher.ViewModel
public class ResultCollection : ObservableCollection, INotifyCollectionChanged
{
- public event NotifyCollectionChangedEventHandler CollectionChanged;
+ public override event NotifyCollectionChangedEventHandler CollectionChanged;
public void RemoveAll()
{
ClearItems();
@@ -259,12 +258,16 @@ namespace Flow.Launcher.ViewModel
///
public void Update(List newItems)
{
+
+
ClearItems();
foreach (var item in newItems)
{
Add(item);
}
+
+ // wpf use directx / double buffered already, so just reset all won't cause ui flickering
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
return;