mac: cefclient: Fix window.close() with --hide-window-on-close (fixes #3660)

This commit is contained in:
Marshall Greenblatt 2024-10-22 16:17:54 -04:00
parent 00e9b561f8
commit 030272fe4c
1 changed files with 3 additions and 2 deletions

View File

@ -817,9 +817,11 @@ void ViewsWindow::OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
bool ViewsWindow::CanClose(CefRefPtr<CefWindow> window) {
CEF_REQUIRE_UI_THREAD();
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
#if defined(OS_MAC)
// On MacOS we might hide the window instead of closing it.
if (hide_on_close_) {
if (hide_on_close_ && browser && !browser->GetHost()->IsReadyToBeClosed()) {
if (window->IsFullscreen()) {
// Need to exit fullscreen mode before hiding the window.
// Execution continues in OnWindowFullscreenTransition.
@ -833,7 +835,6 @@ bool ViewsWindow::CanClose(CefRefPtr<CefWindow> window) {
#endif
// Allow the window to close if the browser says it's OK.
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
if (browser) {
return browser->GetHost()->TryCloseBrowser();
}