From 211eb8a747ea5b1ee13ca6764202ecc5cac78fa8 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 26 Feb 2026 17:24:41 +0800 Subject: [PATCH] Refactor plugin enabled check with thread safety Extract plugin enabled check into a new CheckPlugin method, adding a lock for thread safety. Update the if statement to use this method instead of inline logic. --- Flow.Launcher.Core/Plugin/QueryBuilder.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/QueryBuilder.cs b/Flow.Launcher.Core/Plugin/QueryBuilder.cs index 3b38a56b7..69d75616e 100644 --- a/Flow.Launcher.Core/Plugin/QueryBuilder.cs +++ b/Flow.Launcher.Core/Plugin/QueryBuilder.cs @@ -35,8 +35,7 @@ namespace Flow.Launcher.Core.Plugin string possibleActionKeyword = terms[0]; string[] searchTerms; - if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPairs) - && pluginPairs.Any(plugin => !plugin.Metadata.Disabled)) + if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPairs) && CheckPlugin(pluginPairs)) { // use non global plugin for query actionKeyword = possibleActionKeyword; @@ -61,5 +60,13 @@ namespace Flow.Launcher.Core.Plugin IsHomeQuery = false }; } + + private static bool CheckPlugin(List pluginPairs) + { + lock (pluginPairs) + { + return pluginPairs.Any(plugin => !plugin.Metadata.Disabled); + } + } } }