From 9b6794f35914cb8333b2c4f4e1a0ad708d317bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Tue, 22 Jul 2025 15:47:04 +0200 Subject: [PATCH] Adds lock around access to TopLevelCommandManager --- .../Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs index b4f6542c93..cf7954023f 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/TopLevelCommandManager.cs @@ -207,7 +207,10 @@ public partial class TopLevelCommandManager : ObservableObject, clone.InsertRange(startIndex, newItems); // now update the actual observable list with the new contents - ListHelpers.InPlaceUpdateList(TopLevelCommands, clone); + lock (TopLevelCommands) + { + ListHelpers.InPlaceUpdateList(TopLevelCommands, clone); + } } public async Task ReloadAllCommandsAsync()