-
Notifications
You must be signed in to change notification settings - Fork 16.2k
fix: prevent crash when keyboard event immediately precedes calling BrowserWindow.close() #27315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Activating a key to close a window will cause a silent crash. Handling the keyboard event will lead to a nullptr dereferenced in Chromium code if the window widget has already been destroyed.
f2dad85
to
25e508c
Compare
Possible to test this? Also - what versions does it exist in & would you mind adding |
I managed to find a way by injecting keyboard events. Forgot that was a thing initially. 👍 |
Release Notes Persisted
|
I have automatically backported this PR to "11-x-y", please check out #27357 |
I have automatically backported this PR to "10-x-y", please check out #27358 |
I have automatically backported this PR to "12-x-y", please check out #27359 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K
Description of Change
Versions affected:
Activating a key to close a window will cause a silent crash. Handling the keyboard event will lead to a nullptr dereferenced in Chromium code if the window widget has already been destroyed.
I've only been able to reproduce this on Windows. I've tested macOS as well.
Callstack when the segfault occurs:

Crash occurs in ui/views/focus/focus_manager.cc
Here's a fiddle gist to reproduce the crash on Windows:
https://gist.github.com/samuelmaddock/26cea69b6001773453c89a6edd55903f
Checklist
npm test
passesRelease Notes
Notes: Fixed crash when a keyboard event immediately precedes calling
browserWindow.close()
on Windows.