8000 fix: don't assign NSAlert to window which is not visible by trop[bot] · Pull Request #23090 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: don't assign NSAlert to window which is not visible #23090

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ Shows a message box, it will block the process until the message box is closed.
It returns the index of the clicked button.

The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
If `browserWindow` is not shown dialog will not be attached to it. In such case It will be displayed as independed window.

### `dialog.showMessageBox([browserWindow, ]options)`

Expand Down
6 changes: 4 additions & 2 deletions shell/browser/ui/message_box_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ int ShowMessageBoxSync(const MessageBoxSettings& settings) {
NSAlert* alert = CreateNSAlert(settings);

// Use runModal for synchronous alert without parent, since we don't have a
// window to wait for.
if (!settings.parent_window)
// window to wait for. Also use it when window is provided but it is not
// shown as it would be impossible to dismiss the alert if it is connected
// to invisible window (see #22671).
if (!settings.parent_window || !settings.parent_window->IsVisible())
return [[alert autorelease] runModal];

__block int ret_code = -1;
Expand Down
0