Skip to content

fix: screen.getCursorScreenPoint() crash on Wayland#50092

Merged
jkleinsc merged 3 commits intomainfrom
fix/wayland-crash-in-GetCursorScreenPoint
Mar 6, 2026
Merged

fix: screen.getCursorScreenPoint() crash on Wayland#50092
jkleinsc merged 3 commits intomainfrom
fix/wayland-crash-in-GetCursorScreenPoint

Conversation

@ckerr
Copy link
Copy Markdown
Member

@ckerr ckerr commented Mar 5, 2026

Description of Change

Closes #50079.

require a Window to exist before calling Screen::getCursorScreenPoint()

CC @codebytere @mitchchn

ui::WaylandScreen::GetCursorScreenPoint() requires at least one window to exist or it can DCHECK / dereference a nullptr. We used to work around this with #35503 but that approach no longer works. This PR is similar in spirit to 35503 but instead checks that !WindowList.IsEmpty() to confirm that at least one window exists.

Checklist

Release Notes

Notes: Fixed an issue where screen.getCursorScreenPoint() crashed on Wayland when it was called before a BrowserWindow had been created

@ckerr ckerr requested a review from codebytere March 5, 2026 17:50
@ckerr ckerr added semver/patch backwards-compatible bug fixes target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. labels Mar 5, 2026
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 5, 2026
@ckerr ckerr force-pushed the fix/wayland-crash-in-GetCursorScreenPoint branch 2 times, most recently from 1a7bd6f to 6dbab20 Compare March 5, 2026 18:41
@ckerr ckerr mentioned this pull request Mar 5, 2026
4 tasks
@ckerr ckerr force-pushed the fix/wayland-crash-in-GetCursorScreenPoint branch from 6dbab20 to 8aa005c Compare March 6, 2026 16:05
@ckerr ckerr requested review from codebytere and mitchchn March 6, 2026 16:07
@ckerr
Copy link
Copy Markdown
Member Author

ckerr commented Mar 6, 2026

@codebytere @mitchchn y'all make good points about this method returning an unhelpful value on Wayland even when it doesn't crash. I've updated the PR accordingly.

fix: support Screen::GetCursorScreenPoint() on X11
@ckerr ckerr force-pushed the fix/wayland-crash-in-GetCursorScreenPoint branch from 8aa005c to 0621538 Compare March 6, 2026 17:21
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 6, 2026
@jkleinsc jkleinsc merged commit dc4ad2e into main Mar 6, 2026
110 of 111 checks passed
@jkleinsc jkleinsc deleted the fix/wayland-crash-in-GetCursorScreenPoint branch March 6, 2026 20:24
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 6, 2026

Release Notes Persisted

Fixed an issue where screen.getCursorScreenPoint() crashed on Wayland when it was called before a BrowserWindow had been created

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 6, 2026

I have automatically backported this PR to "40-x-y", please check out #50104

@trop trop bot added the in-flight/40-x-y label Mar 6, 2026
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 6, 2026

I have automatically backported this PR to "41-x-y", please check out #50105

@trop trop bot removed the target/40-x-y PR should also be added to the "40-x-y" branch. label Mar 6, 2026
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Mar 6, 2026

I have automatically backported this PR to "39-x-y", please check out #50106

@trop trop bot added in-flight/41-x-y in-flight/39-x-y merged/39-x-y PR was merged to the "39-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. and removed target/41-x-y PR should also be added to the "41-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch. in-flight/39-x-y in-flight/41-x-y in-flight/40-x-y labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/39-x-y PR was merged to the "39-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wayland segfault when calling screen.getCursorScreenPoint()

4 participants