From be11f21131887ca6a756ee75b651602badf008c0 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 4 Nov 2024 17:08:58 -0500 Subject: [PATCH] Free CefMenuRunnerViews on BrowserView destruction (see #3790) CefMenuRunnerViews holds a raw_ptr that must be cleared during CefBrowserViewImpl destruction. --- libcef/browser/alloy/alloy_browser_host_impl.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libcef/browser/alloy/alloy_browser_host_impl.cc b/libcef/browser/alloy/alloy_browser_host_impl.cc index 481e6facf..6adfd2ecf 100644 --- a/libcef/browser/alloy/alloy_browser_host_impl.cc +++ b/libcef/browser/alloy/alloy_browser_host_impl.cc @@ -551,6 +551,10 @@ void AlloyBrowserHostImpl::WindowDestroyed() { CEF_REQUIRE_UIT(); DCHECK(!window_destroyed_); window_destroyed_ = true; + + // Destroy objects that may reference the window. + menu_manager_.reset(nullptr); + CloseBrowser(true); } @@ -929,8 +933,9 @@ void AlloyBrowserHostImpl::PrintCrossProcessSubframe( int document_cookie, content::RenderFrameHost* subframe_host) const { auto* client = printing::PrintCompositeClient::FromWebContents(web_contents); - if (client) + if (client) { client->PrintCrossProcessSubframe(rect, document_cookie, subframe_host); + } } content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab(