Skip to content
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

fix: crash on BrowserWindow.setEnabled() #34904

Merged
merged 1 commit into from Jul 19, 2022
Merged

Conversation

codebytere
Copy link
Member

Description of Change

Fixes #34707.

Fixes an issue where calling BrowserWindow.setEnabled(false) would crash. This was happening because we were attempting to create a sheet modal on the window with itself. Fix this by instead creating a dummy sheet window to disable interaction with the main window.

Checklist

Release Notes

Notes: Fixed a crash when calling BrowserWindow.setEnabled().

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/18-x-y labels Jul 13, 2022
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Jul 13, 2022
@@ -484,7 +484,8 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) {
// [window_ performClose:nil], the window won't close properly
// even after the user has ended the sheet.
// Ensure it's closed before calling [window_ performClose:nil].
SetEnabled(true);
if ([window_ attachedSheet])
Copy link
Member Author

Choose a reason for hiding this comment

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

this is changed to make more explicit exactly what is happening.

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jul 14, 2022
@codebytere codebytere merged commit eb8c945 into main Jul 19, 2022
@codebytere codebytere deleted the fix-setenabled-crash branch July 19, 2022 10:31
@release-clerk
Copy link

release-clerk bot commented Jul 19, 2022

Release Notes Persisted

Fixed a crash when calling BrowserWindow.setEnabled().

@trop
Copy link
Contributor

trop bot commented Jul 19, 2022

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

@trop
Copy link
Contributor

trop bot commented Jul 19, 2022

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

@trop trop bot removed the target/19-x-y label Jul 19, 2022
@trop
Copy link
Contributor

trop bot commented Jul 19, 2022

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

schetle pushed a commit to schetle/electron that referenced this pull request Nov 3, 2022
fix: crash on BrowserWindow.setEnabled()
khalwa pushed a commit to solarwindscloud/electron that referenced this pull request Feb 22, 2023
fix: crash on BrowserWindow.setEnabled()
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.

[Bug]: Disabling BrowserWindow object causes crash on MacOS
2 participants