Skip to content

Delay folder registration until owner restoration - #624

Merged
coneilen merged 1 commit into
mainfrom
coneilen-microsoft-windows-preview-rebuild
Oct 4, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-microsoft-windows-preview-rebuild

Conversation

@coneilen

@coneilen coneilen commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Prevents the Windows shell from registering a selected folder before USER32
has finished restoring the picker owner window after IFileDialog::Show
returns.

Changes

  • replace the immediate posted completion message with a dedicated one-shot
    window timer
  • process queued owner activation/focus messages before changing the project,
    subscription, layout, and daemon registration state
  • cancel the timer before dispatch and during window destruction
  • extend the real-HWND regression to prove owner restoration precedes exactly
    one completion, cancel is inert, repeated accept is safe, and timer IDs do
    not collide

Test plan

RED: zig test src\App.zig src\AccessibilityProvider.cpp src\FilePicker.c .graphcode-tools\providers\winghostty\zig-out\lib\winghostty-win32-host.lib -target x86_64-windows-msvc --test-filter "folder picker completion waits for native callback unwind" -> expected 0 posted completions, found 1
GREEN: zig test src\App.zig src\AccessibilityProvider.cpp src\FilePicker.c .graphcode-tools\providers\winghostty\zig-out\lib\winghostty-win32-host.lib -target x86_64-windows-msvc --test-filter "folder picker completion waits for native callback unwind" -> 1/1 passed
REGRESSION: pwsh -NoProfile -File Tools\windows\validate.ps1 -Task windows-shell -SkipTrayLive -ShellValidationRoot C:\v5 -SwiftExecutable $env:GRAPHCODE_SWIFT633 -> exit 0; 52/52 sections, App 736/736, Worktree process 21/21, shell smoke, daemon handoff, tray contracts, and full UIA passed

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test)
  • Code follows the existing style (make check)
  • I added the test/contract before the implementation and observed the intended RED failure

The Dev Box reproduced the pre-fix production crash after native Ctrl+O and
Select Folder: daemon registration succeeded once, then the shell terminated
with USER32 0xc0000005 / callback escape 0xc000041d. This Windows host could
not deliver the attended picker-opening accelerator or menu input reliably, so
the post-fix native accept path remains NotExecuted locally and must be rerun
on the Dev Box. No dump was collected or required for this source-level fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit 2fede5a into main Oct 4, 2026
24 checks passed
@coneilen
coneilen deleted the coneilen-microsoft-windows-preview-rebuild branch October 4, 2026 23:13
@coneilen coneilen mentioned this pull request Oct 4, 2026
3 of 5 tasks
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.

1 participant