Closed Taronyu closed 1 month ago
Part of resolving this issue would be adding test coverage for mixing Alloy- and Chrome-style BrowserViews in a single Chrome-style Window. See here for background.
// [...] Alloy style Windows with the /// Views framework can host only Alloy style BrowserViews but Chrome style /// Windows can host both style BrowserViews. Additionally, a Chrome style /// Window can host at most one Chrome style BrowserView but potentially /// multiple Alloy style BrowserViews.
@Taronyu With your use case, is the overlay BrowserView always focusable/activatable? For context, a |can_activate| argument was recently added to CefWindow::AddOverlayView (see PR #676).
Yes it is. We use it to embed a browser into a main browser window and it must be usable as a regular browser, e.g. receive keyboard and mouse input events. That PR is actually from me.
Best, Philipp
@Taronyu have you tried adding --use-alloy-style
to the cefclient launch commands?
I remember your example to work with --use-alloy-style
flag and CEF_RUNTIME_STYLE_ALLOY
:
class BrowserViewDelegate : public CefBrowserViewDelegate {
public:
cef_runtime_style_t GetBrowserRuntimeStyle() override {
return CEF_RUNTIME_STYLE_ALLOY;
}
IMPLEMENT_REFCOUNTING(BrowserViewDelegate);
};
CefBrowserSettings settings = {};
browser_view_ = CefBrowserView::CreateBrowserView(
nullptr, "https://bitbucket.org/chromiumembedded/cef/", settings, nullptr,
nullptr, new BrowserViewDelegate());
https://bitbucket.org/chromiumembedded/cef/pull-requests/816
Yes, this appears to work with Alloy style browsers (tested M130). I'm adding some tests for it now.
Thanks, I will have a look tomorrow when I'm back in the office.
Update: Adding --use-alloy-style
is indeed working for the example. I will check with our real code if that fixes our problem there. Thanks
Dangling raw_ptr after showing the right-click context menu in the overlay BrowserView on MacOS:
[10679:259:1104/141119.045040:ERROR:partition_alloc_support.cc(600)] Detected dangling raw_ptr with id=0x0000012402d430c8:
[DanglingSignature] base::debug::CollectStackTrace(base::span<void remote_cocoa::NativeWidgetNSWindowBridge::CloseWindow() void No active task
The memory was freed at:
0 Chromium Embedded Framework 0x00000003cbde0a78 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 84
1 Chromium Embedded Framework 0x00000003cbdafe88 base::debug::StackTrace::StackTrace(unsigned long) + 156
2 Chromium Embedded Framework 0x00000003cbdaff30 base::debug::StackTrace::StackTrace(unsigned long) + 36
3 Chromium Embedded Framework 0x00000003cbdf16ac base::allocator::(anonymous namespace)::DanglingRawPtrDetected(unsigned long) + 516
4 Chromium Embedded Framework 0x00000003b70246f4 partition_alloc::internal::InSlotMetadata::CheckDanglingPointersOnFree(unsigned long long) + 108
5 Chromium Embedded Framework 0x00000003b7024cec partition_alloc::internal::InSlotMetadata::ReleaseFromAllocator() + 144
6 Chromium Embedded Framework 0x00000003b7022874 partition_alloc::PartitionRoot::FreeNoHooksImmediate(void*, partition_alloc::internal::SlotSpanMetadata<(partition_alloc::internal::MetadataKind)1>*, unsigned long) + 712
7 Chromium Embedded Framework 0x00000003cbef9138 void partition_alloc::PartitionRoot::FreeInline<(partition_alloc::internal::FreeFlags)2>(void*) + 396
8 Chromium Embedded Framework 0x00000003cbf13230 allocator_shim::internal::PartitionAllocFunctionsInternal<(partition_alloc::internal::AllocFlags)16, (partition_alloc::internal::FreeFlags)2>::Free(void*, void*) + 180
9 Chromium Embedded Framework 0x00000003b7222b54 CefBrowserViewImpl::~CefBrowserViewImpl() + 36
10 Chromium Embedded Framework 0x00000003b7229e9c void content::BrowserThread::DeleteOnThread<(content::BrowserThread::ID)0>::Destruct<CefBrowserViewImpl>(CefBrowserViewImpl const*) + 80
11 Chromium Embedded Framework 0x00000003b7227aa0 CefBrowserViewImpl::Release() const + 48
12 Chromium Embedded Framework 0x00000003b6dfc374 CefCppToCRefCounted<CefBrowserViewCppToC, CefBrowserView, _cef_browser_view_t>::UnderlyingRelease() const + 36
13 Chromium Embedded Framework 0x00000003b6dfa03c CefCppToCRefCounted<CefBrowserViewCppToC, CefBrowserView, _cef_browser_view_t>::Release() const + 28
14 Chromium Embedded Framework 0x00000003b6dfbfac CefCppToCRefCounted<CefBrowserViewCppToC, CefBrowserView, _cef_browser_view_t>::struct_release(_cef_base_ref_counted_t*) + 300
15 cefclient 0x0000000102ae3c38 CefCToCppRefCounted<CefBrowserViewCToCpp, CefBrowserView, _cef_browser_view_t>::UnderlyingRelease() const + 80
16 cefclient 0x0000000102ae3750 CefCToCppRefCounted<CefBrowserViewCToCpp, CefBrowserView, _cef_browser_view_t>::Release() const + 48
17 cefclient 0x000000010291c188 scoped_refptr<CefBrowserView>::Release(CefBrowserView*) + 32
18 cefclient 0x000000010291c154 scoped_refptr<CefBrowserView>::~scoped_refptr() + 56
19 cefclient 0x000000010291c0a4 scoped_refptr<CefBrowserView>::~scoped_refptr() + 28
20 cefclient 0x0000000102933a68 scoped_refptr<CefBrowserView>::reset() + 76
21 cefclient 0x000000010292fb5c scoped_refptr<CefBrowserView>::operator=(std::nullptr_t) + 32
22 cefclient 0x000000010292f894 client::ViewsOverlayBrowser::Destroy() + 464
23 cefclient 0x000000010293e870 client::ViewsWindow::OnWindowChanged(scoped_refptr<CefView>, bool) + 860
24 cefclient 0x0000000102ae73e0 (anonymous namespace)::browser_view_delegate_on_window_changed(_cef_view_delegate_t*, _cef_view_t*, int) + 460
25 Chromium Embedded Framework 0x00000003b6dfdf70 CefBrowserViewDelegateCToCpp::OnWindowChanged(scoped_refptr<CefView>, bool) + 328
26 Chromium Embedded Framework 0x00000003b702cd14 CefViewView<BrowserView, CefBrowserViewDelegate>::RemovedFromWidget() + 96
27 Chromium Embedded Framework 0x00000003b702cc90 ChromeBrowserView::RemovedFromWidget() + 28
28 Chromium Embedded Framework 0x00000003d4fc4734 views::View::PropagateRemoveNotifications(views::View*, views::View*, bool) + 384
29 Chromium Embedded Framework 0x00000003d4fb3818 views::View::DoRemoveChildView(views::View*, bool, bool, views::View*) + 516
30 Chromium Embedded Framework 0x00000003d4fb39e0 views::View::RemoveAllChildViews() + 96
31 Chromium Embedded Framework 0x00000003b72647c4 CefWindowView::DeleteDelegate() + 148
Task trace:
0 Chromium Embedded Framework 0x00000003d103fa34 remote_cocoa::NativeWidgetNSWindowBridge::CloseWindow() + 712
1 Chromium Embedded Framework 0x00000003cce55d00 IPC::ChannelAssociatedGroupController::Accept(mojo::Message*) + 1084
2 Chromium Embedded Framework 0x00000003cc1b11c8 mojo::SimpleWatcher::Context::Notify(unsigned int, MojoHandleSignalsState, unsigned int) + 312
The dangling raw_ptr was released at:
0 Chromium Embedded Framework 0x00000003cbde0a78 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 84
1 Chromium Embedded Framework 0x00000003cbdafe88 base::debug::StackTrace::StackTrace(unsigned long) + 156
2 Chromium Embedded Framework 0x00000003cbdaff30 base::debug::StackTrace::StackTrace(unsigned long) + 36
3 Chromium Embedded Framework 0x00000003cbdf18ec void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)0>(unsigned long) + 80
4 Chromium Embedded Framework 0x00000003cbef0d14 base::internal::RawPtrBackupRefImpl<false, false>::ReleaseInternal(unsigned long) + 448
5 Chromium Embedded Framework 0x00000003b702e3d8 void base::internal::RawPtrBackupRefImpl<false, false>::ReleaseWrappedPtr<CefBrowserViewImpl>(CefBrowserViewImpl*) + 204
6 Chromium Embedded Framework 0x00000003b702e2e8 base::raw_ptr<CefBrowserViewImpl, (partition_alloc::internal::RawPtrTraits)0>::~raw_ptr() + 32
7 Chromium Embedded Framework 0x00000003b702c004 base::raw_ptr<CefBrowserViewImpl, (partition_alloc::internal::RawPtrTraits)0>::~raw_ptr() + 28
8 Chromium Embedded Framework 0x00000003b723c464 CefMenuRunnerViews::~CefMenuRunnerViews() + 48
9 Chromium Embedded Framework 0x00000003b723c3a8 CefMenuRunnerViews::~CefMenuRunnerViews() + 28
10 Chromium Embedded Framework 0x00000003b723c3d4 CefMenuRunnerViews::~CefMenuRunnerViews() + 28
11 Chromium Embedded Framework 0x00000003b6f58068 std::__Cr::default_delete<CefMenuRunner>::operator()(CefMenuRunner*) const + 52
12 Chromium Embedded Framework 0x00000003b6f58024 std::__Cr::unique_ptr<CefMenuRunner, std::__Cr::default_delete<CefMenuRunner>>::reset(CefMenuRunner*) + 68
13 Chromium Embedded Framework 0x00000003b70c5094 CefMenuManager::Destroy() + 64
14 Chromium Embedded Framework 0x00000003b6f41b7c AlloyBrowserHostImpl::DestroyBrowser() + 220
15 Chromium Embedded Framework 0x00000003b6fd1680 CefBrowserInfoManager::DestroyAllBrowsers() + 404
16 Chromium Embedded Framework 0x00000003b703c488 CefContext::ShutdownOnUIThread() + 156
17 Chromium Embedded Framework 0x00000003b703e104 void base::internal::DecayedFunctorTraits<void (CefContext::*)(), CefContext*>::Invoke<void (CefContext::*)(), CefContext*>(void (CefContext::*)(), CefContext*&&) + 140
18 Chromium Embedded Framework 0x00000003b703e04c void base::internal::InvokeHelper<false, base::internal::FunctorTraits<void (CefContext::*&&)(), CefContext*>, void, 0ul>::MakeItSo<void (CefContext::*)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>>(void (CefContext::*&&)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>&&) + 108
19 Chromium Embedded Framework 0x00000003b703dfd4 void base::internal::Invoker<base::internal::FunctorTraits<void (CefContext::*&&)(), CefContext*>, base::internal::BindState<true, true, false, void (CefContext::*)(), base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, void ()>::RunImpl<void (CefContext::*)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, 0ul>(void (CefContext::*&&)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>&&, std::__Cr::integer_sequence<unsigned long, 0ul>) + 32
20 Chromium Embedded Framework 0x00000003b703df5c base::internal::Invoker<base::internal::FunctorTraits<void (CefContext::*&&)(), CefContext*>, base::internal::BindState<true, true, false, void (CefContext::*)(), base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, void ()>::RunOnce(base::internal::BindStateBase*) + 44
21 Chromium Embedded Framework 0x00000003b6f707a0 base::OnceCallback<void ()>::Run() && + 220
22 Chromium Embedded Framework 0x00000003b708f820 CefMainRunner::StartShutdownOnUIThread(base::OnceCallback<void ()>) + 168
23 Chromium Embedded Framework 0x00000003b708f648 CefMainRunner::Shutdown(base::OnceCallback<void ()>, base::OnceCallback<void ()>) + 436
24 Chromium Embedded Framework 0x00000003b703b47c CefContext::Shutdown() + 336
25 Chromium Embedded Framework 0x00000003b703b288 CefShutdown() + 284
26 Chromium Embedded Framework 0x00000003b6dcdac0 cef_shutdown + 12
27 cefclient 0x0000000102be5128 cef_shutdown + 24
28 cefclient 0x0000000102accc38 CefShutdown() + 12
29 cefclient 0x00000001028dd768 client::MainContextImpl::Shutdown() + 520
30 cefclient 0x000000010297632c client::(anonymous namespace)::RunMain(int, char**) + 1492
31 cefclient 0x0000000102975d4c main + 36
Task trace:
No active task.
Please check for more information on:
https://chromium.googlesource.com/chromium/src/+/main/docs/dangling_ptr_guide.md
Googlers: Please give us your feedback about the dangling pointer
detector at:
http://go/dangling-ptr-cq-survey
Received signal 6
0 Chromium Embedded Framework 0x00000003cbde0a78 base::debug::CollectStackTrace(base::span<void const*, 18446744073709551615ul, void const**>) + 84
1 Chromium Embedded Framework 0x00000003cbdafe88 base::debug::StackTrace::StackTrace(unsigned long) + 156
2 Chromium Embedded Framework 0x00000003cbdaff30 base::debug::StackTrace::StackTrace(unsigned long) + 36
3 Chromium Embedded Framework 0x00000003cbdafefc base::debug::StackTrace::StackTrace() + 40
4 Chromium Embedded Framework 0x00000003cbde08b8 base::debug::(anonymous namespace)::StackDumpSignalHandler(int, __siginfo*, void*) + 1352
5 libsystem_platform.dylib 0x000000018d374184 _sigtramp + 56
6 libsystem_pthread.dylib 0x000000018d33ef70 pthread_kill + 288
7 libsystem_c.dylib 0x000000018d24b908 abort + 128
8 Chromium Embedded Framework 0x00000003cbdf1d00 void base::allocator::(anonymous namespace)::DanglingRawPtrReleased<(base::features::DanglingPtrMode)0, (base::features::DanglingPtrType)1>(unsigned long) + 0
9 Chromium Embedded Framework 0x00000003cbef0d14 base::internal::RawPtrBackupRefImpl<false, false>::ReleaseInternal(unsigned long) + 448
10 Chromium Embedded Framework 0x00000003b702e3d8 void base::internal::RawPtrBackupRefImpl<false, false>::ReleaseWrappedPtr<CefBrowserViewImpl>(CefBrowserViewImpl*) + 204
11 Chromium Embedded Framework 0x00000003b702e2e8 base::raw_ptr<CefBrowserViewImpl, (partition_alloc::internal::RawPtrTraits)0>::~raw_ptr() + 32
12 Chromium Embedded Framework 0x00000003b702c004 base::raw_ptr<CefBrowserViewImpl, (partition_alloc::internal::RawPtrTraits)0>::~raw_ptr() + 28
13 Chromium Embedded Framework 0x00000003b723c464 CefMenuRunnerViews::~CefMenuRunnerViews() + 48
14 Chromium Embedded Framework 0x00000003b723c3a8 CefMenuRunnerViews::~CefMenuRunnerViews() + 28
15 Chromium Embedded Framework 0x00000003b723c3d4 CefMenuRunnerViews::~CefMenuRunnerViews() + 28
16 Chromium Embedded Framework 0x00000003b6f58068 std::__Cr::default_delete<CefMenuRunner>::operator()(CefMenuRunner*) const + 52
17 Chromium Embedded Framework 0x00000003b6f58024 std::__Cr::unique_ptr<CefMenuRunner, std::__Cr::default_delete<CefMenuRunner>>::reset(CefMenuRunner*) + 68
18 Chromium Embedded Framework 0x00000003b70c5094 CefMenuManager::Destroy() + 64
19 Chromium Embedded Framework 0x00000003b6f41b7c AlloyBrowserHostImpl::DestroyBrowser() + 220
20 Chromium Embedded Framework 0x00000003b6fd1680 CefBrowserInfoManager::DestroyAllBrowsers() + 404
21 Chromium Embedded Framework 0x00000003b703c488 CefContext::ShutdownOnUIThread() + 156
22 Chromium Embedded Framework 0x00000003b703e104 void base::internal::DecayedFunctorTraits<void (CefContext::*)(), CefContext*>::Invoke<void (CefContext::*)(), CefContext*>(void (CefContext::*)(), CefContext*&&) + 140
23 Chromium Embedded Framework 0x00000003b703e04c void base::internal::InvokeHelper<false, base::internal::FunctorTraits<void (CefContext::*&&)(), CefContext*>, void, 0ul>::MakeItSo<void (CefContext::*)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>>(void (CefContext::*&&)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>&&) + 108
24 Chromium Embedded Framework 0x00000003b703dfd4 void base::internal::Invoker<base::internal::FunctorTraits<void (CefContext::*&&)(), CefContext*>, base::internal::BindState<true, true, false, void (CefContext::*)(), base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, void ()>::RunImpl<void (CefContext::*)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, 0ul>(void (CefContext::*&&)(), std::__Cr::tuple<base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>&&, std::__Cr::integer_sequence<unsigned long, 0ul>) + 32
25 Chromium Embedded Framework 0x00000003b703df5c base::internal::Invoker<base::internal::FunctorTraits<void (CefContext::*&&)(), CefContext*>, base::internal::BindState<true, true, false, void (CefContext::*)(), base::internal::UnretainedWrapper<CefContext, base::unretained_traits::MayNotDangle, (partition_alloc::internal::RawPtrTraits)0>>, void ()>::RunOnce(base::internal::BindStateBase*) + 44
26 Chromium Embedded Framework 0x00000003b6f707a0 base::OnceCallback<void ()>::Run() && + 220
27 Chromium Embedded Framework 0x00000003b708f820 CefMainRunner::StartShutdownOnUIThread(base::OnceCallback<void ()>) + 168
28 Chromium Embedded Framework 0x00000003b708f648 CefMainRunner::Shutdown(base::OnceCallback<void ()>, base::OnceCallback<void ()>) + 436
29 Chromium Embedded Framework 0x00000003b703b47c CefContext::Shutdown() + 336
30 Chromium Embedded Framework 0x00000003b703b288 CefShutdown() + 284
31 Chromium Embedded Framework 0x00000003b6dcdac0 cef_shutdown + 12
32 cefclient 0x0000000102be5128 cef_shutdown + 24
33 cefclient 0x0000000102accc38 CefShutdown() + 12
34 cefclient 0x00000001028dd768 client::MainContextImpl::Shutdown() + 520
35 cefclient 0x000000010297632c client::(anonymous namespace)::RunMain(int, char**) + 1492
36 cefclient 0x0000000102975d4c main + 36
37 dyld 0x000000018cfbc274 start + 2840
[end of stack trace]
Describe the bug We use
AddOverlayView
with browser views to embed a browser view on top of our main browser. Starting from CEF 125 this was broken due to a crash (issue #3784) which got fixed thankfully. However, now the browser view is not shown anymore. In our application I see that the browser instance is null. According to the documentation the browser is only created once the view is added to the view hierarchy, but as far as I understood this should happen whenCefWindow::AddOverlayView
is called.I did not see anything obviously wrong with the calling code. I compared it to other elements of cefclient and cefsimple that are added via
AddOverlayView
. I suspect that the browser instance is not created, given thatCefBrowserView::GetBrowser
returnsnullptr
.To Reproduce Steps to reproduce the behavior:
--use-views --hide-frame --hide-controls
Expected behavior Browser view is created and shown in parent window on top of its content.
Screenshots N/A
Versions (please complete the following information):
Additional context With the provided patch for cefclient it is possible to reproduce the issue. cefclient_testcode.patch