From 4537013cde8acd362431a2106ba1e92fe98536d1 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 26 Feb 2026 17:19:36 +0800 Subject: [PATCH] Clean up empty plugin lists from _nonGlobalPlugins After removing plugins, also remove dictionary entries if their associated lists become empty. This prevents unused empty lists from accumulating and keeps the plugin manager's state clean. --- Flow.Launcher.Core/Plugin/PluginManager.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 9bd573179..a4fcb866e 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -816,6 +816,11 @@ namespace Flow.Launcher.Core.Plugin lock (plugins) { plugins.RemoveAll(p => p.Metadata.ID == id); + + if (plugins.Count == 0) + { + _nonGlobalPlugins.TryRemove(new KeyValuePair>(oldActionkeyword, plugins)); + } } } } @@ -1081,6 +1086,11 @@ namespace Flow.Launcher.Core.Plugin lock (entry.Value) { entry.Value.RemoveAll(p => p.Metadata.ID == plugin.ID); + + if (entry.Value.Count == 0) + { + _nonGlobalPlugins.TryRemove(entry.Key, out var __); + } } } }