From 3b771d155da131e856112410448c96c869c48c99 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 26 Feb 2026 17:07:41 +0800 Subject: [PATCH] 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. --- Flow.Launcher.Core/Plugin/PluginManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 13308c233..0223affeb 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -591,7 +591,10 @@ namespace Flow.Launcher.Core.Plugin var nonGlobalPlugins = new Dictionary>(); foreach (var kvp in _nonGlobalPlugins) { - nonGlobalPlugins.Add(kvp.Key, [.. kvp.Value]); + lock (kvp.Value) + { + nonGlobalPlugins.Add(kvp.Key, [.. kvp.Value]); + } } return nonGlobalPlugins; }