#53574: fix: resolve the file dialog's parent HWND on the UI thread on Windows
Merged
Created: Sep 4, 2026, 10:32:49 PM
Merged: Sep 5, 2026, 9:52:26 AM
5 comments
Target: main
Description of Change
dialog.showOpenDialog() / showSaveDialog() (and the download manager's default Save prompt) run the native dialog on dialog_thread, and ShowFileDialog resolved the parent HWND there via NativeWindowViews::GetAcceleratedWidget() → views::Widget::GetNativeWindow(), which reads a UI-thread WeakPtr. In DCHECK builds that's sequence_checker.cc: CalledOnValidSequence and a browser-process crash (CI hit); in release builds it's an unsynchronised read of a window the UI thread may be tearing down.
- Resolve the HWND on the UI thread in
ShowOpenDialog/ShowSaveDialog/Show*DialogSyncand pass it into the dialog-thread function, the same waymessage_box_win.cchas done since the M110 roll. No header or cross-platform change. - The CI hit came from
asar-spec.ts"saves a packed PDF from the PDF viewer": its click loop can start a second download, which had nowill-downloadhandler and fell through to the real Save dialog. Give every download from that test a save path (or refuse it) synchronously inwill-download.
Checklist
- PR description included
-
npm testpasses
Release Notes
Notes: Fixed a possible crash on Windows when a file dialog was shown for a window that was being closed at the same time.
Backports
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron