8000 fix: prevent crash when keyboard event immediately precedes calling BrowserWindow.close() by samuelmaddock · Pull Request #27315 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 2 commits into from
Jan 19, 2021

Conversation

samuelmaddock
Copy link
Member
@samuelmaddock samuelmaddock commented Jan 13, 2021

Description of Change

Versions affected:

  • 10.2.0
  • 11.2.0
  • 12.0.0-beta.14

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:
devenv_2021-01-12_18-49-59OBpJ

Crash occurs in ui/views/focus/focus_manager.cc

bool FocusManager::RedirectAcceleratorToBubbleAnchorWidget(
    const ui::Accelerator& accelerator) {
  views::BubbleDialogDelegate* widget_delegate =
      widget_->widget_delegate()->AsBubbleDialogDelegate();

Here's a fiddle gist to reproduce the crash on Windows:
https://gist.github.com/samuelmaddock/26cea69b6001773453c89a6edd55903f

Checklist

Release Notes

Notes: Fixed crash when a keyboard event immediately precedes calling browserWindow.close() on Windows.

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.
@codebytere
Copy link
Member
codebytere commented Jan 14, 2021

Possible to test this? Also - what versions does it exist in & would you mind adding target/ labels?

@codebytere codebytere added semver/patch backwards-compatible bug fixes and removed crash 💥 platform/windows labels Jan 14, 2021
@samuelmaddock
Copy link
Member Author

Possible to test this?

I managed to find a way by injecting keyboard events. Forgot that was a thing initially. 👍

@samuelmaddock samuelmaddock changed the title fix: prevent crash when BrowserWindow is closed in response to a keyboard event fix: prevent crash when keyboard event immediately precedes calling BrowserWindow.close() Jan 14, 2021
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jan 14, 2021
@zcbenz zcbenz merged commit 4334110 into electron:master Jan 19, 2021
@release-clerk
Copy link
release-clerk bot commented Jan 19, 2021

Release Notes Persisted

Fixed crash when a keyboard event immediately precedes calling browserWindow.close() on Windows.

@trop
Copy link
Contributor
trop bot commented Jan 19, 2021

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

@trop trop bot removed the target/11-x-y label Jan 19, 2021
@trop
Copy link
Contributor
trop bot commented Jan 19, 2021

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

@trop
Copy link
Contributor
trop bot commented Jan 19, 2021

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

@trop trop bot removed the target/10-x-y label Jan 19, 2021
@samuelmaddock samuelmaddock deleted the fix/esc-widget-crash branch January 19, 2021 20:20
Copy link
@nardl nardl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K

This was referenced Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0