mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix possible result update issue for plugins with IResultUpdate interface
This commit is contained in:
parent
304f98e9ed
commit
0c43ea9379
1 changed files with 23 additions and 14 deletions
|
|
@ -1447,26 +1447,35 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
#endif
|
||||
|
||||
foreach (var metaResults in resultsForUpdates)
|
||||
try
|
||||
{
|
||||
foreach (var result in metaResults.Results)
|
||||
foreach (var metaResults in resultsForUpdates)
|
||||
{
|
||||
if (_topMostRecord.IsTopMost(result))
|
||||
foreach (var result in metaResults.Results)
|
||||
{
|
||||
result.Score = int.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var priorityScore = metaResults.Metadata.Priority * 150;
|
||||
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore;
|
||||
if (_topMostRecord.IsTopMost(result))
|
||||
{
|
||||
result.Score = int.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var priorityScore = metaResults.Metadata.Priority * 150;
|
||||
result.Score += _userSelectedRecord.GetSelectedCount(result) + priorityScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// it should be the same for all results
|
||||
bool reSelect = resultsForUpdates.First().ReSelectFirstResult;
|
||||
|
||||
Results.AddResults(resultsForUpdates, token, reSelect);
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
// Plugin with IResultUpdate interface can somtimes throw this exception
|
||||
// Collection was modified; enumeration operation may not execute
|
||||
Log.Exception($"{nameof(MainViewModel)}.{nameof(UpdateResultView)}|UpdateResultView failed", e);
|
||||
}
|
||||
|
||||
// it should be the same for all results
|
||||
bool reSelect = resultsForUpdates.First().ReSelectFirstResult;
|
||||
|
||||
Results.AddResults(resultsForUpdates, token, reSelect);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Reference in a new issue