fix: don't let pending shell operations block app exit on Windows by trop[bot] · Pull Request #52899 · electron/electron · GitHub
Skip to content

fix: don't let pending shell operations block app exit on Windows - #52899

Merged
MarshallOfSound merged 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-don-t-let-pending-shell-operations-block-app-exit-on-windows-1786954323675
Aug 17, 2026
Merged

MarshallOfSound merged 1 commit into
41-x-yfrom
trop/41-x-y-bp-fix-don-t-let-pending-shell-operations-block-app-exit-on-windows-1786954323675

Conversation

@trop

@trop trop Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Backport of #52888

See that PR for details.

Notes: Fixed an issue on Windows where the app process could fail to exit after app.quit() while a shell.openExternal() or shell.openPath() call was still waiting on a system "Open with" dialog.

shell.openExternal(), shell.openPath() and shell.showItemInFolder() run
ShellExecuteEx()/SHOpenFolderAndSelectItems() on a COM STA thread-pool
task with the default SKIP_ON_SHUTDOWN behaviour. A SKIP_ON_SHUTDOWN task
that has already started blocks ThreadPoolInstance::Shutdown(), and
ShellExecuteEx() can block inside the OS for as long as Windows is showing
UI for the request - for example the "you'll need a new app to open this
link" dialog for a URL scheme with no registered handler. The result is
that app.quit() never completes (the process lingers after 'quit' has
fired) until the user dismisses that system dialog.

Post these tasks with CONTINUE_ON_SHUTDOWN instead, matching Chrome's
platform_util::OpenItem, which uses that trait for the same reason. The
tasks only touch their bound arguments and OS APIs, so letting shutdown
proceed while one is still blocked in the shell is safe.

Fixes #52141.

No-Verification-Needed: Windows-only source not built on this host; verified via Windows CI experiment

Co-authored-by: Sam Attard <sattard@anthropic.com>
@trop
trop Bot requested a review from MarshallOfSound August 17, 2026 08:12
@trop trop Bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Aug 17, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) August 17, 2026 08:13
@MarshallOfSound
MarshallOfSound merged commit 832e70a into 41-x-y Aug 17, 2026
89 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/41-x-y-bp-fix-don-t-let-pending-shell-operations-block-app-exit-on-windows-1786954323675 branch August 17, 2026 10:06
@release-clerk

release-clerk Bot commented Aug 17, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant