Add locking for thread safety in GetNonGlobalPlugins

Wrap kvp.Value access in a lock when copying to nonGlobalPlugins
to prevent race conditions and ensure thread safety during
concurrent access.
This commit is contained in:
Jack251970 2026-02-26 17:07:41 +08:00
parent 452e60f3b5
commit 3b771d155d

View file

@ -591,7 +591,10 @@ namespace Flow.Launcher.Core.Plugin
var nonGlobalPlugins = new Dictionary<string, List<PluginPair>>();
foreach (var kvp in _nonGlobalPlugins)
{
nonGlobalPlugins.Add(kvp.Key, [.. kvp.Value]);
lock (kvp.Value)
{
nonGlobalPlugins.Add(kvp.Key, [.. kvp.Value]);
}
}
return nonGlobalPlugins;
}