From 8f4a47479c1accb552eeab494cc77c8799398b13 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 15 Jul 2024 16:42:19 -0400 Subject: [PATCH] mac: cefclient: Fix zombie NSWindow object on exit (fixes #3602) - Don't create a TempWindow when using Views. - Don't call `close` on an NSWindow that is never opened. --- tests/cefclient/browser/root_window_manager.cc | 5 +++-- tests/cefclient/browser/temp_window_mac.mm | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/cefclient/browser/root_window_manager.cc b/tests/cefclient/browser/root_window_manager.cc index eeef80525..f7f61c3b7 100644 --- a/tests/cefclient/browser/root_window_manager.cc +++ b/tests/cefclient/browser/root_window_manager.cc @@ -141,8 +141,9 @@ scoped_refptr RootWindowManager::CreateRootWindowAsPopup( SanityCheckWindowConfig(is_devtools, use_views, use_alloy_style, with_osr); - if (!temp_window_) { - // TempWindow must be created on the UI thread. + if (!temp_window_ && !use_views) { + // TempWindow must be created on the UI thread. It is only used with + // native (non-Views) parent windows. temp_window_.reset(new TempWindow()); } diff --git a/tests/cefclient/browser/temp_window_mac.mm b/tests/cefclient/browser/temp_window_mac.mm index c23044581..ee21c09de 100644 --- a/tests/cefclient/browser/temp_window_mac.mm +++ b/tests/cefclient/browser/temp_window_mac.mm @@ -29,7 +29,7 @@ class TempWindowMacImpl { } ~TempWindowMacImpl() { DCHECK(window_); - [window_ close]; + window_ = nil; } private: