Skip to content

CmdPal: Fix Dock refresh resource leak - #49742

Merged
Michael Jolley (michaeljolley) merged 3 commits into
mainfrom
feature/cmdpal-dock-refresh-resource-leak
Aug 14, 2026
Merged

CmdPal: Fix Dock refresh resource leak#49742
Michael Jolley (michaeljolley) merged 3 commits into
mainfrom
feature/cmdpal-dock-refresh-resource-leak

Conversation

@jiripolasek

@jiripolasek Jiří PolÃĄÅĄek (jiripolasek) commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary of the Pull Request

This PR improves Dock band refresh and partially eliminates our favorite leak:

  • Reuses Dock item view models while their source items remain stable.
  • Coalesces bursty ItemsChanged notifications into a single follow-up refresh.
  • Cleans replaced and discarded view models after applying UI updates.
  • Prevents queued refreshes from repopulating bands after cleanup.
  • Handles unavailable UI schedulers without abandoning created view models.
  • Adds unit tests for reuse and cleanup.

Pictures? Pictures!

Before

image

After

image

PR Checklist

  • 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
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

stack merge was automatically disabled August 8, 2026 18:43

Pull Request is not mergeable

stack merge was automatically disabled August 9, 2026 18:48

Pull Request is not mergeable

stack merge was automatically disabled August 9, 2026 18:48

Pull Request is not mergeable

@michaeljolley
Michael Jolley (michaeljolley) force-pushed the feature/cmdpal-dock-refresh-resource-leak branch from 4e0f483 to 64c72f6 Compare August 9, 2026 18:56
@jiripolasek

Jiří PolÃĄÅĄek (jiripolasek) commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

👀 I'm looking into the failed build.

For some reason report sanitizer UT failed:

image

While I investigate, I'm re-running the build - the regex might have just timed out.

@jiripolasek

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Base automatically changed from dev/jpolasek/f/cmdpal-fix-dock-band-activation-lifecycle to main August 12, 2026 22:33
- Reuse Dock item view models while their source items remain stable.
- Coalesce bursty ItemsChanged notifications into a single follow-up refresh.
- Clean replaced and discarded view models after applying UI updates.
- Prevent queued refreshes from repopulating bands after cleanup.
- Handles unavailable UI schedulers without abandoning created view models.
- Adds unit tests for reuse and cleanup.
â€ĶtCache.

- ApplyRefresh publishes that prepared cache directly; it no longer reconstructs it via unsafe Items[i] indexing.
- Added a many-to-one regression test.
@michaeljolley
Michael Jolley (michaeljolley) force-pushed the feature/cmdpal-dock-refresh-resource-leak branch from 64c72f6 to 1ab69c3 Compare August 12, 2026 22:34
@michaeljolley
Michael Jolley (michaeljolley) merged commit f1548fc into main Aug 14, 2026
8 checks passed
@michaeljolley
Michael Jolley (michaeljolley) deleted the feature/cmdpal-dock-refresh-resource-leak branch August 14, 2026 22:44
@jiripolasek

Copy link
Copy Markdown
Collaborator Author
thankGIF

Boliang Zhang (LegendaryBlair) pushed a commit that referenced this pull request Aug 17, 2026
## Summary of the Pull Request

This PR improves Dock band refresh and partially eliminates our favorite
leak:

- Reuses Dock item view models while their source items remain stable.
- Coalesces bursty ItemsChanged notifications into a single follow-up
refresh.
- Cleans replaced and discarded view models after applying UI updates.
- Prevents queued refreshes from repopulating bands after cleanup.
- Handles unavailable UI schedulers without abandoning created view
models.
- Adds unit tests for reuse and cleanup.

## Pictures? Pictures!

Before

<img width="1671" height="400" alt="image"
src="https://github.com/user-attachments/assets/3a0874e6-eded-44f0-8bc2-bfa223e2888d"
/>

After

<img width="1671" height="716" alt="image"
src="https://github.com/user-attachments/assets/1560bfdb-5701-40bd-9f20-d4e885159ab8"
/>

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #49428
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **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

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b3fb20d-6e9d-4fef-a5cd-f8921d28c220
## Validation Steps Performed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CmdPal - Dock Issues related to the Command Palette Dock Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Command Palette] Repeated CommandProvider.ItemsChanged events cause unbounded resource growth and UI hang

4 participants