Skip to content

Fix context menu command thread affinity - #2546

Merged
ge0rdi merged 1 commit into
Open-Shell:masterfrom
YellowNest:fix/issue-2536-context-menu-freeze
Oct 4, 2026
Merged

ge0rdi merged 1 commit into
Open-Shell:masterfrom
YellowNest:fix/issue-2536-context-menu-freeze

Conversation

@YellowNest

Copy link
Copy Markdown

Summary

Invoke shell context-menu commands on the thread that created the IContextMenu object instead of passing the interface pointer to a separate STA thread.

Keep opencontaining non-blocking by using the existing SHOpenFolderAndSelectItemsSafe path, which performs the shell operation on the worker STA without moving the IContextMenu interface across apartments.

Why

The worker-STA invocation was introduced to avoid the Windows 11 "Open file location" delay. However, shell context-menu handlers can require invocation on the thread that created the context-menu object, as the existing special case for properties already demonstrates.

This also avoids passing a raw apartment-bound IContextMenu interface pointer to another STA.

Verification

  • GitHub Actions Build completed successfully for commit dfbbb969ab28a125c3e1cdc89c86f50279b25ffa.
  • Send to -> Desktop (create shortcut) creates the shortcut without freezing Open-Shell.
  • Open file location still opens Explorer and selects the item.
  • Properties still opens normally.

Fixes #2536

@ge0rdi ge0rdi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me.
Thank you.

@ge0rdi
ge0rdi merged commit 1e7a52a into Open-Shell:master Oct 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open-Shell Freezes when right-clicking an item in the Start menu > Send to > Desktop (Create a shortcut)

2 participants