From 5e30caa674e19748c18f33c119540c8430437a4a Mon Sep 17 00:00:00 2001 From: Dave Rayment Date: Fri, 20 Feb 2026 15:49:42 +0000 Subject: [PATCH 1/2] [WindowWalker] Fix race condition in UWP app enumeration (#45601) ## Summary of the Pull Request This fixes a race condition in the WindowWalker component in both **Command Palette** and **Run**. The lack of a lock around a cache update could potentially lead to inaccurate information about UWP applications being returned. ## PR Checklist - [x] Closes: #45600 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments More details about the root cause can be found in the original issue: #45600. In summary, a `Task` is created and started as part of the `CreateWindowProcessInstance()` code. The creation is inside a lock, but there is no lock around access to the `_handlesToProcessCache` cache within the Task itself, which will run on a different thread. ## Validation Steps Performed - Ensured unit tests still pass (NB: I cannot currently run CmdPal UI tests for some reason) - Manually ran the applications, testing the Window Walker component in both --- .../Microsoft.CmdPal.Ext.WindowWalker/Components/Window.cs | 6 +++++- .../Microsoft.Plugin.WindowWalker/Components/Window.cs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/Window.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/Window.cs index c071d55e80..8db2e709fb 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/Window.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/Window.cs @@ -395,7 +395,11 @@ internal sealed class Window var childProcessName = WindowProcess.GetProcessNameFromProcessID(childProcessId); // Update process info in cache - _handlesToProcessCache[hWindow].UpdateProcessInfo(childProcessId, childThreadId, childProcessName); + lock (_handlesToProcessCache) + { + _handlesToProcessCache[hWindow].UpdateProcessInfo(childProcessId, childThreadId, childProcessName); + } + return false; } else diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs index cb01d9f59c..5786b63581 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs @@ -404,7 +404,11 @@ namespace Microsoft.Plugin.WindowWalker.Components var childProcessName = WindowProcess.GetProcessNameFromProcessID(childProcessId); // Update process info in cache - _handlesToProcessCache[hWindow].UpdateProcessInfo(childProcessId, childThreadId, childProcessName); + lock (_handlesToProcessCache) + { + _handlesToProcessCache[hWindow].UpdateProcessInfo(childProcessId, childThreadId, childProcessName); + } + return false; } else From b64afea9f70833895a8e9c9247b59d7b0234541d Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Fri, 20 Feb 2026 17:53:49 +0100 Subject: [PATCH 2/2] Fix for AP settings page crashing (#45699) Don't put anything other than `SettingsCard` in a `SettingsExpander`.. because it will blow up --- .../SettingsXAML/Views/AdvancedPastePage.xaml | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml index 3345528652..3b59daa7da 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml @@ -152,6 +152,18 @@ x:Uid="AdvancedPasteUI_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}" IsExpanded="True"> + + + + + + + @@ -166,16 +178,7 @@ IsEnabled="{x:Bind ViewModel.ClipboardHistoryEnabled, Mode=OneWay}"> - - - - - +