From 8760fe29eeded1c43d6e016ae531ea1443903954 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 26 Feb 2026 17:05:12 +0800 Subject: [PATCH] Return deep copy in GetNonGlobalPlugins to protect state GetNonGlobalPlugins now returns a new dictionary with copied lists, preventing external modification of the internal _nonGlobalPlugins collection. This change improves encapsulation and safeguards plugin manager state integrity. --- Flow.Launcher.Core/Plugin/PluginManager.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index e837843f4..ddc3a2d52 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -588,7 +588,12 @@ namespace Flow.Launcher.Core.Plugin public static Dictionary> GetNonGlobalPlugins() { - return _nonGlobalPlugins.ToDictionary(); + var nonGlobalPlugins = new Dictionary>(); + foreach (var kvp in _nonGlobalPlugins) + { + nonGlobalPlugins.Add(kvp.Key, [.. kvp.Value]); + } + return nonGlobalPlugins; } public static List GetTranslationPlugins()