Skip to content

fix: resolve the file dialog's parent HWND on the UI thread on Windows - #53584

Merged
MarshallOfSound merged 1 commit into
43-x-yfrom
trop/43-x-y-bp-fix-resolve-the-file-dialog-s-parent-hwnd-on-the-ui-thread-on-windows-1788619958258
Sep 5, 2026
Merged

MarshallOfSound merged 1 commit into
43-x-yfrom
trop/43-x-y-bp-fix-resolve-the-file-dialog-s-parent-hwnd-on-the-ui-thread-on-windows-1788619958258

Conversation

@trop

@trop trop Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Backport of #53574

See that PR for details.

Notes: Fixed a possible crash on Windows when a file dialog was shown for a window that was being closed at the same time.

ShowOpenDialog/ShowSaveDialog run the dialog on dialog_thread, and
ShowFileDialog resolved the parent HWND there by calling
NativeWindowViews::GetAcceleratedWidget(), which goes through
views::Widget::GetNativeWindow() and its UI-thread WeakPtr. That trips
the sequence checker in DCHECK builds and is an unsynchronised read of a
window the UI thread may be destroying otherwise. Resolve the HWND on
the UI thread before posting, as message_box_win.cc already does.

Seen once in CI when the asar PDF-viewer spec's click loop started a
second download with no save path and the default Save dialog opened;
also make that spec give every download a path or refuse it.

Co-authored-by: Sam Attard <[email protected]>
@trop
trop Bot requested a review from MarshallOfSound September 5, 2026 14:53
@trop trop Bot added 43-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Sep 5, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) September 5, 2026 14:55
@MarshallOfSound MarshallOfSound self-assigned this Sep 5, 2026
@MarshallOfSound
MarshallOfSound merged commit 9e67a48 into 43-x-y Sep 5, 2026
96 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/43-x-y-bp-fix-resolve-the-file-dialog-s-parent-hwnd-on-the-ui-thread-on-windows-1788619958258 branch September 5, 2026 16:03
@release-clerk

release-clerk Bot commented Sep 5, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a possible crash on Windows when a file dialog was shown for a window that was being closed at the same time.

renovate Bot added a commit to cigaleapp/cigale that referenced this pull request Sep 20, 2026
##### [v44.3.0](https://github.com/electron/electron/releases/tag/v44.3.0)

### Release Notes for v44.3.0

#### Features

- Added the `ELECTRON_DEBUG_DRAGGABLE_REGIONS` environment variable, which visualizes and logs draggable regions in unpackaged apps to help debug custom title bars. [#53627](electron/electron#53627) <sup>(Also in [43](electron/electron#53633), [45](https://github.com/electron/electron/pull/53626))</sup>

#### Fixes

- File System Access permission requests and the `file-system-access-restricted` event are scoped to the requesting document, grants are reset when the origin's last page closes, and write access works in in-memory sessions. [#53691](electron/electron#53691) <sup>(Also in [42](electron/electron#53695), [43](electron/electron#53694), [45](https://github.com/electron/electron/pull/53690))</sup>
- Fixed Ctrl+Y not yanking text killed with Ctrl+K in text fields on macOS. [#53714](electron/electron#53714) <sup>(Also in [45](https://github.com/electron/electron/pull/53715))</sup>
- Fixed `Tray` icons not appearing when running inside Flatpak or Snap sandboxes on Linux. [#53653](electron/electron#53653) <sup>(Also in [45](https://github.com/electron/electron/pull/53654))</sup>
- Fixed `app.getGPUInfo('complete')` stalling the GPU process for several seconds on some Windows systems. [#53644](electron/electron#53644) <sup>(Also in [45](https://github.com/electron/electron/pull/53645))</sup>
- Fixed `session.setPermissionCheckHandler` receiving the top-level origin and a null `webContents` for `hid` and `usb` checks made from a subframe. [#53688](electron/electron#53688) <sup>(Also in [42](electron/electron#53736), [43](electron/electron#53689), [45](https://github.com/electron/electron/pull/53679))</sup>
- Fixed `webContents.on()`, `removeListener()` and `removeAllListeners()` throwing "Object has been destroyed" for `console-message` listeners after the WebContents was destroyed. [#53494](electron/electron#53494) <sup>(Also in [42](electron/electron#53497), [43](electron/electron#53496), [45](https://github.com/electron/electron/pull/53495))</sup>
- Fixed a crash on Linux when `process.env` was written while another thread was reading the environment, and a memory leak when a worker thread exits. [#53509](electron/electron#53509) <sup>(Also in [42](electron/electron#53511), [43](electron/electron#53510), [45](https://github.com/electron/electron/pull/53508))</sup>
- Fixed a possible crash on Windows when a file dialog was shown for a window that was being closed at the same time. [#53583](electron/electron#53583) <sup>(Also in [42](electron/electron#53585), [43](electron/electron#53584), [45](https://github.com/electron/electron/pull/53586))</sup>
- Fixed a renderer crash when the main process sent IPC to, or a page navigated, a same-process `window.open()` child whose `contextIsolation` differed from its opener's. [#53539](electron/electron#53539) <sup>(Also in [42](electron/electron#53541), [43](electron/electron#53540), [45](https://github.com/electron/electron/pull/53538))</sup>
- Fixed a spurious `node_init` error being logged when creating a `ShadowRealm` with Node.js integration enabled. [#53579](electron/electron#53579) <sup>(Also in [45](https://github.com/electron/electron/pull/53578))</sup>
- Fixed crashes in `setDisplayMediaRequestHandler` when the granted frame had been destroyed or another tab was granted by id. [#53672](electron/electron#53672) <sup>(Also in [42](electron/electron#53674), [43](electron/electron#53671), [45](https://github.com/electron/electron/pull/53673))</sup>
- Fixed several non-functional DevTools integrations: the Security panel's "View certificate" button, Ctrl+wheel zooming inside DevTools, and DevTools keyboard shortcuts (e.g. F8) while the inspected page has focus. [#53630](electron/electron#53630) <sup>(Also in [43](electron/electron#53631), [45](https://github.com/electron/electron/pull/53471))</sup>
- Fixed window state not being persisted when a window entered or left fullscreen, or was maximized or unmaximized, without also being moved or resized. [#53576](electron/electron#53576) <sup>(Also in [45](https://github.com/electron/electron/pull/53577))</sup>
- Internal `<webview>`, `window.close()` and `executeJavaScript` reply IPCs are validated against the sending frame. [#53723](electron/electron#53723) <sup>(Also in [42](electron/electron#53727), [43](electron/electron#53726), [45](https://github.com/electron/electron/pull/53724))</sup>
- `<webview>` without `allowpopups` also blocks links opened into a new window by modifier-click, and such windows navigate as the clicking document rather than as a browser-initiated load. [#53721](electron/electron#53721) <sup>(Also in [42](electron/electron#53719), [43](electron/electron#53718), [45](https://github.com/electron/electron/pull/53717))</sup>
- `getUserMedia` with `chromeMediaSource: 'desktop'` no longer accepts WebContents source ids; use `chromeMediaSource: 'tab'` with `webContents.getMediaSourceId()` or `setDisplayMediaRequestHandler` to capture a WebContents. [#53709](electron/electron#53709) <sup>(Also in [42](electron/electron#53710), [43](electron/electron#53707), [45](https://github.com/electron/electron/pull/53708))</sup>
- `nodeIntegrationInWorker` now applies only to workers created by frames that themselves have Node integration; enable `nodeIntegrationInSubFrames` to keep Node in workers created by subframes. [#53711](electron/electron#53711) <sup>(Also in [42](electron/electron#53713), [43](electron/electron#53712), [45](https://github.com/electron/electron/pull/53706))</sup>
- `openExternal` permission requests started by a frame that has since gone away are attributed to that frame's origin rather than to the navigating page. [#53699](electron/electron#53699) <sup>(Also in [42](electron/electron#53697), [43](electron/electron#53698), [45](https://github.com/electron/electron/pull/53696))</sup>
- `pointerLock` and `keyboardLock` permission requests now report the requesting frame, and `execCommand('paste')` requires user activation in the frame that calls it. [#53693](electron/electron#53693) <sup>(Also in [42](electron/electron#53702), [43](electron/electron#53701), [45](https://github.com/electron/electron/pull/53692))</sup>

#### Other Changes

- Fixed the app becoming unresponsive when a page has a very large number of `app-region` draggable elements. [#53597](electron/electron#53597) <sup>(Also in [43](electron/electron#53632), [45](https://github.com/electron/electron/pull/53596))</sup>
- Updated Chromium to 152.0.7977.78. [#53523](electron/electron#53523)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

43-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