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: prevent potential modal window close segfault #22410

Merged
merged 1 commit into from
Feb 28, 2020
Merged

Conversation

codebytere
Copy link
Member

Description of Change

Fixes #17558.

We were previously trying to call close on a sheet itself, instead of calling [NSWindow endSheet:] on the sheet's parent. As such, the window would either freeze since the modal session wasn't ended properly, or crash. To fix this, we need to end the sheet properly by calling [sheetParent endSheet:window];, where window is the sheet itself.

However! If we just call that synchronously, we block the thread with an animation, so we instead post a task. This fix was verified with the repro provided in the issue linked above.

cc @zcbenz @nornagon @MarshallOfSound

Checklist

Release Notes

Notes: Fixed an occasional segfault with modal windows being closed or destroyed.

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

Seems legit but why are we disabling some tests in this PR?

@codebytere
Copy link
Member Author

@MarshallOfSound we're not - if you look at the change we used to disable all modal tests for darwin, and my change makes it such that we disable individual tests and not the suite, since i do want the new test to run on darwin

@codebytere codebytere changed the title fix: do not call close on sheets themselves fix: prevent potential modal window close segfault Feb 27, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Feb 28, 2020
@codebytere codebytere merged commit 2c97491 into master Feb 28, 2020
@release-clerk
Copy link

release-clerk bot commented Feb 28, 2020

Release Notes Persisted

Fixed an occasional segfault with modal windows being closed or destroyed.

@trop
Copy link
Contributor

trop bot commented Feb 28, 2020

I was unable to backport this PR to "8-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 28, 2020

I was unable to backport this PR to "7-1-x" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Feb 28, 2020

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

@codebytere codebytere deleted the fix-window-crash branch February 28, 2020 23:11
@trop trop bot removed the in-flight/9-x-y label Mar 2, 2020
@trop
Copy link
Contributor

trop bot commented Mar 2, 2020

@codebytere has manually backported this PR to "8-x-y", please check out #22481

@trop
Copy link
Contributor

trop bot commented Mar 5, 2020

@codebytere has manually backported this PR to "7-1-x", please check out #22540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS: BrowserWindow.destroy() can cause segfaults
3 participants