fix: crash when exiting simple fullscreen on macOS (#20144)

This commit is contained in:
Shelley Vohr 2019-09-12 13:38:16 -04:00 committed by GitHub
parent 5dee8a5717
commit 3ec17a88ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -178,8 +178,14 @@ bool ScopedDisableResize::disable_resize_ = false;
}
- (void)toggleFullScreenMode:(id)sender {
if (shell_->simple_fullscreen())
shell_->SetSimpleFullScreen(!shell_->IsSimpleFullScreen());
bool is_simple_fs = shell_->IsSimpleFullScreen();
bool always_simple_fs = shell_->always_simple_fullscreen();
// If we're in simple fullscreen mode and trying to exit it
// we need to ensure we exit it properly to prevent a crash
// with NSWindowStyleMaskTitled mode
if (is_simple_fs || always_simple_fs)
shell_->SetSimpleFullScreen(!is_simple_fs);
else
[super toggleFullScreen:sender];
}