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: DCHECK minimizing parent window with non-modal child #38460

Merged
merged 1 commit into from May 31, 2023
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented May 25, 2023

Description of Change

Closes #38459.

NativeWidgetNSWindowBridge::NotifyVisibilityChangeDown() expects that the parent window's children have all been hidden before the window is hidden, or there is a DCHECK. This fixes that.

We previously solved something similar in #29821 - however, here, we can't just detach the windows. The children need to reappear when the window becomes visible again, so we instead need to add some mechanics to hide and restore windows appropriately. I took my cue upstream from components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm - which has these same mechanics for similar reasons.

Checklist

Release Notes

Notes: Fixed potential issues when minimizing parent windows with non-modal children on macOS.

@codebytere codebytere added semver/patch backwards-compatible bug fixes target/23-x-y PR should also be added to the "23-x-y" branch. target/24-x-y PR should also be added to the "24-x-y" branch. target/25-x-y PR should also be added to the "25-x-y" branch. labels May 25, 2023
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label May 25, 2023
spec/api-browser-window-spec.ts Show resolved Hide resolved
@codebytere codebytere marked this pull request as draft May 26, 2023 08:59
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label May 26, 2023
@codebytere codebytere force-pushed the fix-dcheck branch 3 times, most recently from bca9121 to 31bcd81 Compare May 30, 2023 08:51
@codebytere codebytere requested a review from ckerr May 30, 2023 08:52
@codebytere codebytere marked this pull request as ready for review May 30, 2023 08:52
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label May 30, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label May 31, 2023
@codebytere codebytere merged commit 40e724e into main May 31, 2023
18 checks passed
@codebytere codebytere deleted the fix-dcheck branch May 31, 2023 09:57
@release-clerk
Copy link

release-clerk bot commented May 31, 2023

Release Notes Persisted

Fixed potential issues when minimizing parent windows with non-modal children on macOS.

@trop
Copy link
Contributor

trop bot commented May 31, 2023

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

@trop trop bot removed the target/23-x-y PR should also be added to the "23-x-y" branch. label May 31, 2023
@trop
Copy link
Contributor

trop bot commented May 31, 2023

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

@trop
Copy link
Contributor

trop bot commented May 31, 2023

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

@trop trop bot added in-flight/24-x-y in-flight/25-x-y merged/25-x-y PR was merged to the "25-x-y" branch. merged/24-x-y PR was merged to the "24-x-y" branch merged/23-x-y PR was merged to the "23-x-y" branch. and removed target/24-x-y PR should also be added to the "24-x-y" branch. target/25-x-y PR should also be added to the "25-x-y" branch. in-flight/25-x-y in-flight/24-x-y labels May 31, 2023
// save and restore it afterwards.
NSInteger level = window_.level;
[window_ addChildWindow:child_nswindow ordered:NSWindowAbove];
[window_ setLevel:level];
Copy link
Contributor

@tzahola tzahola Nov 16, 2023

Choose a reason for hiding this comment

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

In the original code, it was the child window's level that had to be restored, but here we're doing it on the parent.

This change wasn't intentional, right?

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

Successfully merging this pull request may close these issues.

[Bug]: DCHECK when minimizing parent window with non-modal child on macOS
4 participants