fix: crash when exiting simple fullscreen on macOS (#20144)
This commit is contained in:
parent
5dee8a5717
commit
3ec17a88ba
3 changed files with 19 additions and 3 deletions
|
@ -161,7 +161,7 @@ class NativeWindowMac : public NativeWindow {
|
||||||
AtomTouchBar* touch_bar() const { return touch_bar_.get(); }
|
AtomTouchBar* touch_bar() const { return touch_bar_.get(); }
|
||||||
bool zoom_to_page_width() const { return zoom_to_page_width_; }
|
bool zoom_to_page_width() const { return zoom_to_page_width_; }
|
||||||
bool fullscreen_window_title() const { return fullscreen_window_title_; }
|
bool fullscreen_window_title() const { return fullscreen_window_title_; }
|
||||||
bool simple_fullscreen() const { return always_simple_fullscreen_; }
|
bool always_simple_fullscreen() const { return always_simple_fullscreen_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// views::WidgetDelegate:
|
// views::WidgetDelegate:
|
||||||
|
|
|
@ -178,8 +178,14 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)toggleFullScreenMode:(id)sender {
|
- (void)toggleFullScreenMode:(id)sender {
|
||||||
if (shell_->simple_fullscreen())
|
bool is_simple_fs = shell_->IsSimpleFullScreen();
|
||||||
shell_->SetSimpleFullScreen(!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
|
else
|
||||||
[super toggleFullScreen:sender];
|
[super toggleFullScreen:sender];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3389,6 +3389,16 @@ describe('BrowserWindow module', () => {
|
||||||
w.setFullScreen(true)
|
w.setFullScreen(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('does not crash when exiting simpleFullScreen', (done) => {
|
||||||
|
const w = new BrowserWindow()
|
||||||
|
w.setSimpleFullScreen(true)
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
w.setFullScreen(!w.isFullScreen())
|
||||||
|
done()
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
|
||||||
it('should not be changed by setKiosk method', (done) => {
|
it('should not be changed by setKiosk method', (done) => {
|
||||||
const w = new BrowserWindow()
|
const w = new BrowserWindow()
|
||||||
w.once('enter-full-screen', async () => {
|
w.once('enter-full-screen', async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue