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: fullscreen crashing with roundedCorners: false #35421

Merged
merged 1 commit into from Aug 25, 2022

Conversation

codebytere
Copy link
Member

Description of Change

Closes #35403.
Refs CL:1125099.

Fixes an issue where frameless windows with roundedCorners: false cannot enter fullscreen without crashing. This is happening because Chromium uses a custom NativeWidgetMacNSWindowBorderlessFrame when the NSWindow has a NSWindowStyleMaskBorderless style mask, which is itself a subclass of NSNextStepFrame. NSNextStepFrame does not implement any of the public or private methods required for fullscreen, and so it would crash with errors like:

-[NativeWidgetMacNSWindowBorderlessFrame _surrenderToolbarViewForFullScreenWindow:]: unrecognized selector sent to instance

The cleanest solution for this would be to document this case in the roundedCorners option, and prevent the window from going fullscreen.

Checklist

Release Notes

Notes: Fixed an issue where frameless windows with roundedCorners: false couldn't enter fullscreen without crashing.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/19-x-y target/21-x-y PR should also be added to the "21-x-y" branch. labels Aug 24, 2022
@codebytere codebytere requested a review from zcbenz August 24, 2022 09:40
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Aug 24, 2022
@codebytere codebytere changed the title fix: fullscreen crashing with roundedCorners fix: fullscreen crashing with roundedCorners: false Aug 24, 2022
@sircharlo
Copy link

Hey there! Quick question: wouldn't it be better to remove the offending roundedCorners attribute before entering fullscreen, and then re-adding it after exiting fullscreen?

@codebytere
Copy link
Member Author

@sircharlo i wish, but it's not just an attribute that can be removed. It's an option that defines how the window and its frame are constructed from the outset, and which can't really be changed without destroying and recreating the underlying NSWindow.

@sircharlo
Copy link

Well, that sucks. I'll have to rethink that part of my app. I was hoping a behavior similar to other apps like VLC that manage this situation, but I guess this is a Chromium quirk.

@codebytere
Copy link
Member Author

codebytere commented Aug 24, 2022

@sircharlo there's potential for overriding that behavior in Electron and allowing for fullscreen, but it'd be a bigger refactor and for now i'd just like to prevent it crashing. I can have a stab at the more complex fix but it might take a while

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 25, 2022
@codebytere
Copy link
Member Author

Unrelated failure - merging.

@codebytere codebytere merged commit a3a9463 into main Aug 25, 2022
@codebytere codebytere deleted the mediate-fullscreen-crash branch August 25, 2022 11:39
@release-clerk
Copy link

release-clerk bot commented Aug 25, 2022

Release Notes Persisted

Fixed an issue where frameless windows with roundedCorners: false couldn't enter fullscreen without crashing.

@trop
Copy link
Contributor

trop bot commented Aug 25, 2022

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

@trop trop bot added in-flight/21-x-y and removed target/21-x-y PR should also be added to the "21-x-y" branch. labels Aug 25, 2022
@trop
Copy link
Contributor

trop bot commented Aug 25, 2022

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

@trop
Copy link
Contributor

trop bot commented Aug 25, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/21-x-y PR was merged to the "21-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: macOS - Using frame, roundedCorners, and fullscreen settings together automatically causes a crash
3 participants