Crash closing browser after zooming after upgrading

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Crash closing browser after zooming after upgrading

Postby hyzerfool » Fri Oct 04, 2024 12:38 pm

If a user closes a browser after zooming in, we hit a fatal error (callstack and log far below). Any suggestions will be deeply appreciated.

We are trying to upgrade from 116.0.15 to 128.4.12. This bug does not occur in 116 for us. We are a Windows MFC program using multiple document interface and the user can open / close multiple browsers.

I noticed that closing browsers wasn't working quite the same in 128 as 116 and I have changed our closing in response to that, which muddles the question of whether our crash is due to zooming whether the crash is due to my breaking things by closing browsers incorrectly.

In 116:
1) Make a note in CMainFrame that we are about to kill a browser
2) Call m_pBrowser->GetHost ()->CloseBrowser (true);
3) DoClose is called, we return false so WM_CLOSE will be sent
4) CMainFrame handles WM_CLOSE and calls m_pViewBeingDestroyed->RemoveView (), which calls DestroyWindow on our view (browser's parent window)
5) This leads to OnBeforeClose being called and the world is a happy place.

In 128
1) Make a note in CMainFrame that we are about to kill a browser
2) Call m_pBrowser->GetHost ()->CloseBrowser (true);
3) DoClose IS NOT CALLED
4) OnBeforeClose is called before WM_CLOSE is sent (I have a breakpoint in PostMessage via the magic of microsoft's Detours library, which I love). OnBeforeClose is called deep underneath WebContentsImpl::Close()

WM_CLOSE is not sent (except later on when I close the CChildFrame, then WM_CLOSE is sent once per browser we closed) so I wasn't finishing closing my browser's parent window. This is the callstack for when WM_CLOSE is finally sent:
Code: Select all
VP - Debug-VP-Main Branch-64.exe!MyPostMessage(HWND__ * hWnd=0x00000000002e20be, unsigned int Msg=16, unsigned __int64 wParam=0, __int64 lParam=0) Line 1095   C++   Symbols loaded.
libcef.dll!ChromeBrowserHostImpl::WindowDestroyed() Line 536   C++   Symbols loaded.
libcef.dll!CefBrowserViewImpl::Detach() Line 253   C++   Symbols loaded.
[snip!]
libcef.dll!base::SupportsUserData::ClearAllUserData() Line 143   C++   Symbols loaded.
libcef.dll!CefViewView<BrowserView,CefBrowserViewDelegate>::~CefViewView() Line 48   C++   Symbols loaded.
libcef.dll!ChromeBrowserView::~ChromeBrowserView() Line 26   C++   Symbols loaded.
libcef.dll![thunk]:ChromeBrowserView::`vector deleting destructor'`adjustor{480}' (unsigned int)   C++   Symbols loaded.
[snip!]
libcef.dll!views::View::DoRemoveChildView(views::View * view=0x00004d14010d45e0, bool update_tool_tip, bool delete_removed_view, views::View * new_parent=0x0000000000000000) Line 3104   C++   Symbols loaded.
libcef.dll!views::View::RemoveAllChildViews() Line 369   C++   Symbols loaded.
libcef.dll!CefWindowView::DeleteDelegate() Line 626   C++   Symbols loaded.
libcef.dll!base::OnceCallback<void ()>::Run() Line 156   C++   Symbols loaded.
libcef.dll!views::WidgetDelegate::DeleteDelegate() Line 292   C++   Symbols loaded.
libcef.dll!views::Widget::HandleWidgetDestroyed() Line 2405   C++   Symbols loaded.
libcef.dll!ChromeBrowserFrame::OnNativeWidgetDestroyed() Line 192   C++   Symbols loaded.
libcef.dll!views::DesktopNativeWidgetAura::OnHostClosed() Line 392   C++   Symbols loaded.
libcef.dll!views::DesktopWindowTreeHostWin::HandleDestroyed() Line 1006   C++   Symbols loaded.
[snip!]
mfc140ud.dll!CMDIChildWndEx::OnDestroy() Line 996   C++   Symbols loaded.


So I modified things and close the browser's parent window from OnBeforeClose and simply kept track of how many WM_CLOSE's we expect and received and, while it felt exceptionally clumsy, it also seemed to work. Until now with the zoom crash.

Here is our cef log (set to warnings)
Code: Select all
[39516:25660:1003/214722.197:ERROR:browser_info_manager.cc(781)] Timeout of new browser info response for frame 17-32A1148EBEA6A38A53B1C1095F6EC67E (has_rfh=0)
[36292:48572:1003/214726.087:FATAL:frame_impl.cc(648)] frame 16-12A8678C06E9B77234C424B2BFB84B26 connection retry failed (reason=BROWSER_FRAME_DISCONNECT, current_state=CONNECTION_PENDING)
[39516:25660:1003/214740.555:FATAL:location_bar_bubble_delegate_view.cc(109)] Check failed: !fullscreen_controller_.WasInvalidated().
[45184:19144:1003/214751.356:ERROR:frame_impl.cc(537)] frame 16-0A9F3E825330732E048697E6C557AD36 connection timeout
[45184:19144:1003/214802.371:ERROR:frame_impl.cc(537)] frame 16-0A9F3E825330732E048697E6C557AD36 connection timeout
[45184:19144:1003/214813.383:ERROR:frame_impl.cc(537)] frame 16-0A9F3E825330732E048697E6C557AD36 connection timeout
[45184:19144:1003/214813.383:FATAL:frame_impl.cc(648)] frame 16-0A9F3E825330732E048697E6C557AD36 connection retry failed (reason=CONNECT_TIMEOUT, current_state=CONNECTION_PENDING)


Callstack when CEF crashes things:
Code: Select all
libcef.dll!logging::LogMessage::HandleFatal(unsigned __int64 stack_start=134, const std::__Cr::basic_string<char,std::__Cr::char_traits<char>,std::__Cr::allocator<char>> & str_newline={...}) Line 1073   C++   Symbols loaded.
[Inline Frame] libcef.dll!logging::LogMessage::Flush::<lambda_0>::operator()() Line 773   C++   Symbols loaded.
[Inline Frame] libcef.dll!absl::cleanup_internal::Storage<`lambda at ..\..\base\logging.cc:771:40'>::InvokeCallback() Line 87   C++   Symbols loaded.
[Inline Frame] libcef.dll!absl::Cleanup<absl::cleanup_internal::Tag,`lambda at ..\..\base\logging.cc:771:40'>::~Cleanup() Line 106   C++   Symbols loaded.
libcef.dll!logging::LogMessage::Flush() Line 956   C++   Symbols loaded.
libcef.dll!logging::LogMessage::~LogMessage() Line 728   C++   Symbols loaded.
[Inline Frame] libcef.dll!logging::`anonymous namespace'::CheckLogMessage::~CheckLogMessage() Line 186   C++   Symbols loaded.
libcef.dll!logging::`anonymous namespace'::CheckLogMessage::~CheckLogMessage() Line 181   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::default_delete<logging::LogMessage>::operator()(logging::LogMessage * __ptr) Line 67   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::unique_ptr<logging::LogMessage,std::__Cr::default_delete<logging::LogMessage>>::reset(logging::LogMessage * __p) Line 278   C++   Symbols loaded.
libcef.dll!logging::CheckError::~CheckError() Line 344   C++   Symbols loaded.
libcef.dll!LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() Line 109   C++   Symbols loaded.
libcef.dll!ZoomBubbleView::~ZoomBubbleView() Line 316   C++   Symbols loaded.
libcef.dll!ZoomBubbleView::~ZoomBubbleView() Line 313   C++   Symbols loaded.
libcef.dll!views::View::~View() Line 290   C++   Symbols loaded.
libcef.dll!views::ClientView::~ClientView() Line 33   C++   Symbols loaded.
libcef.dll!views::DialogClientView::~DialogClientView() Line 121   C++   Symbols loaded.
libcef.dll!views::DialogClientView::~DialogClientView() Line 116   C++   Symbols loaded.
libcef.dll!views::View::~View() Line 290   C++   Symbols loaded.
libcef.dll!views::BubbleFrameView::~BubbleFrameView() Line 141   C++   Symbols loaded.
libcef.dll!views::BubbleFrameView::~BubbleFrameView() Line 141   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::default_delete<views::NonClientFrameView>::operator()(views::NonClientFrameView * __ptr) Line 67   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::unique_ptr<views::NonClientFrameView,std::__Cr::default_delete<views::NonClientFrameView>>::reset(views::NonClientFrameView * __p) Line 278   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::unique_ptr<views::NonClientFrameView,std::__Cr::default_delete<views::NonClientFrameView>>::~unique_ptr() Line 248   C++   Symbols loaded.
libcef.dll!views::NonClientView::~NonClientView() Line 179   C++   Symbols loaded.
libcef.dll!views::NonClientView::~NonClientView() Line 175   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::default_delete<views::View>::operator()(views::View * __ptr) Line 67   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::unique_ptr<views::View,std::__Cr::default_delete<views::View>>::reset(views::View * __p) Line 278   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::unique_ptr<views::View,std::__Cr::default_delete<views::View>>::~unique_ptr() Line 248   C++   Symbols loaded.
libcef.dll!views::View::DoRemoveChildView(views::View * view=0x00007814069e4400, bool update_tool_tip, bool delete_removed_view, views::View * new_parent=0x0000000000000000) Line 3104   C++   Symbols loaded.
libcef.dll!views::View::RemoveAllChildViews() Line 369   C++   Symbols loaded.
libcef.dll!views::Widget::DestroyRootView() Line 2189   C++   Symbols loaded.
libcef.dll!views::Widget::~Widget() Line 252   C++   Symbols loaded.
libcef.dll!views::`anonymous namespace'::DialogWidget::~DialogWidget() Line 45   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::default_delete<views::internal::NativeWidgetDelegate>::operator()(views::internal::NativeWidgetDelegate * __ptr) Line 67   C++   Symbols loaded.
[Inline Frame] libcef.dll!std::__Cr::unique_ptr<views::internal::NativeWidgetDelegate,std::__Cr::default_delete<views::internal::NativeWidgetDelegate>>::reset(views::internal::NativeWidgetDelegate * __p) Line 278   C++   Symbols loaded.
libcef.dll!views::DesktopNativeWidgetAura::~DesktopNativeWidgetAura() Line 322   C++   Symbols loaded.
libcef.dll!views::DesktopNativeWidgetAura::~DesktopNativeWidgetAura() Line 311   C++   Symbols loaded.
libcef.dll!views::DesktopNativeWidgetAura::OnHostClosed() Line 394   C++   Symbols loaded.
libcef.dll!views::DesktopWindowTreeHostWin::HandleDestroyed() Line 1006   C++   Symbols loaded.
libcef.dll!views::HWNDMessageHandler::OnWndProc(unsigned int message=130, unsigned __int64 w_param=0, __int64 l_param=0) Line 1111   C++   Symbols loaded.
libcef.dll!gfx::WindowImpl::WndProc(HWND__ * hwnd=0x0000000000470f9c, unsigned int message=130, unsigned __int64 w_param=0, __int64 l_param=0) Line 310   C++   Symbols loaded.
libcef.dll!base::win::WrappedWindowProc<&gfx::WindowImpl::WndProc>(HWND__ * hwnd, unsigned int message, unsigned __int64 wparam, __int64 lparam) Line 77   C++   Symbols loaded.
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)   Unknown   Symbols loaded.
user32.dll!CallWindowProcW()   Unknown   Symbols loaded.
mfc140ud.dll!_AfxActivationWndProc(HWND__ * hWnd=0x0000000000470f9c, unsigned int nMsg=130, unsigned __int64 wParam=0, __int64 lParam=0) Line 478   C++   Symbols loaded.
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)   Unknown   Symbols loaded.
user32.dll!DispatchClientMessage()   Unknown   Symbols loaded.
user32.dll!__fnNCDESTROY()   Unknown   Symbols loaded.
ntdll.dll!KiUserCallbackDispatcherContinue()   Unknown   Symbols loaded.
win32u.dll!NtUserDestroyWindow()   Unknown   Symbols loaded.
[Inline Frame] libcef.dll!base::internal::DecayedFunctorTraits<void (AlloyWebContentsDialogHelper::*)(),const base::WeakPtr<AlloyWebContentsDialogHelper> &>::Invoke(void(AlloyWebContentsDialogHelper::*)() method, const base::WeakPtr<AlloyWebContentsDialogHelper> & receiver_ptr) Line 738   C++   Symbols loaded.
[Inline Frame] libcef.dll!base::internal::InvokeHelper<1,base::internal::FunctorTraits<void (AlloyWebContentsDialogHelper::*const &)(),const base::WeakPtr<AlloyWebContentsDialogHelper> &>,void,0>::MakeItSo(void(AlloyWebContentsDialogHelper::*)() & functor, const std::__Cr::tuple<base::WeakPtr<AlloyWebContentsDialogHelper>> & bound) Line 954   C++   Symbols loaded.
[Inline Frame] libcef.dll!base::internal::Invoker<base::internal::FunctorTraits<void (AlloyWebContentsDialogHelper::*const &)(),const base::WeakPtr<AlloyWebContentsDialogHelper> &>,base::internal::BindState<1,1,0,void (AlloyWebContentsDialogHelper::*)(),base::WeakPtr<AlloyWebContentsDialogHelper>>,void ()>::RunImpl(void(AlloyWebContentsDialogHelper::*)() & functor, const std::__Cr::tuple<base::WeakPtr<AlloyWebContentsDialogHelper>> & bound, std::__Cr::integer_sequence<unsigned long long,0>) Line 1067   C++   Symbols loaded.
libcef.dll!base::internal::Invoker<base::internal::FunctorTraits<void (AlloyWebContentsDialogHelper::*const &)(),const base::WeakPtr<AlloyWebContentsDialogHelper> &>,base::internal::BindState<1,1,0,void (AlloyWebContentsDialogHelper::*)(),base::WeakPtr<AlloyWebContentsDialogHelper>>,void ()>::Run(base::internal::BindStateBase * base=0x0000000000000000) Line 989   C++   Symbols loaded.
libcef.dll!base::OnceCallback<void ()>::Run() Line 156   C++   Symbols loaded.


Help?!
hyzerfool
Techie
 
Posts: 35
Joined: Wed May 13, 2015 2:37 pm

Re: Crash closing browser after zooming after upgrading

Postby ndesktop » Sat Oct 05, 2024 4:47 am

Try --disable-chrome-runtime first (while it is still around). If this passes, it is probably because now chrome runtime is the default.
ndesktop
Master
 
Posts: 821
Joined: Thu Dec 03, 2015 10:10 am

Re: Crash closing browser after zooming after upgrading

Postby magreenblatt » Sat Oct 05, 2024 1:50 pm

DoClose will be called with Alloy style browsers. You will likely want to use that. See https://github.com/chromiumembedded/cef/issues/3685
magreenblatt
Site Admin
 
Posts: 12744
Joined: Fri May 29, 2009 6:57 pm

Re: Crash closing browser after zooming after upgrading

Postby hyzerfool » Tue Oct 08, 2024 9:37 am

Thanks for the tips. My immediate solution is to upgrade to 125 for our next release (where our browser closing works correctly), which gives me time to learn about the shiny new things after that...
hyzerfool
Techie
 
Posts: 35
Joined: Wed May 13, 2015 2:37 pm

Re: Crash closing browser after zooming after upgrading

Postby hyzerfool » Tue Oct 08, 2024 3:08 pm

For anyone else who might hit this, we ended up taking magreenbatt's suggestion and using alloy style browsers. In our case, at least, the complete work to achieve this was to add:
Code: Select all
info.runtime_style = CEF_RUNTIME_STYLE_ALLOY;

before calls to CefBrowserHost::CreateBrowser

As far as I can tell, this has fixed our close browser issues and the zoom-in crash.

Very much appreciate the help!
hyzerfool
Techie
 
Posts: 35
Joined: Wed May 13, 2015 2:37 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 31 guests