Skip to content

Commit

Permalink
fix: don't assign NSAlert to window which is not visible
Browse files Browse the repository at this point in the history
Without this change it's possible to create message box which can't
be dismissed on mac.
  • Loading branch information
CezaryKulakowski committed Mar 12, 2020
1 parent 4b9f2bc commit 03852dd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions shell/browser/ui/message_box_mac.mm
Expand Up @@ -93,12 +93,11 @@

} // namespace

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)
if (!settings.parent_window || !settings.parent_window->IsVisible())
return [[alert autorelease] runModal];

__block int ret_code = -1;
Expand Down

0 comments on commit 03852dd

Please sign in to comment.