Crash on closing the application

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 on closing the application

Postby sikor » Fri Feb 15, 2019 9:19 am

Hi,
I have encountered a crash during closing the application that uses CEF.
CEF version: 3578; It happened on Windows; Application is build on x86 .
The crash stack looks like that:
Code: Select all
libcef.dll!Profile::MaybeSendDestroyedNotification() Line 294   C++
libcef.dll!CefBrowserContext::Shutdown() Line 83   C++
libcef.dll!CefBrowserContextImpl::~CefBrowserContextImpl() Line 228   C++
libcef.dll!CefBrowserContextImpl::~CefBrowserContextImpl() Line 217   C++
libcef.dll!CefBrowserContextImpl::RemoveCefRequestContext(CefRequestContextImpl * context) Line 338   C++
libcef.dll!CefRequestContextImpl::~CefRequestContextImpl() Line 150   C++
[External Code]   
libcef.dll!content::BrowserThread::DeleteOnThread<content::BrowserThread::UI>::Destruct<CefImageImpl>(const CefImageImpl * x) Line 147   C++
[External Code]   
libcef.dll!CefBrowserHostImpl::~CefBrowserHostImpl() Line 598   C++
[External Code]   
libcef.dll!CefCppToCRefCounted<CefBrowserCppToC,CefBrowser,_cef_browser_t>::Release() Line 85   C++
libcef.dll!CefCppToCRefCounted<CefAuthCallbackCppToC,CefAuthCallback,_cef_auth_callback_t>::struct_release(_cef_base_ref_counted_t * base) Line 179   C++


Extra note, CefInitialize and CefShutdown are called from the same thread.

The crash happened once till now, but I would like to understand what might be possible causes.

Any thoughts?
sikor
Techie
 
Posts: 12
Joined: Tue Sep 27, 2016 4:08 am

Re: Crash on closing the application

Postby magreenblatt » Fri Feb 15, 2019 10:03 am

Maybe you’re still holding a CefAuthCallback reference after OnBeforeClose for the associated browser?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Crash on closing the application

Postby sikor » Mon Feb 18, 2019 3:12 am

I quickly checked. I don't use that anywhere.
sikor
Techie
 
Posts: 12
Joined: Tue Sep 27, 2016 4:08 am

Re: Crash on closing the application

Postby sikor » Thu Feb 21, 2019 3:27 am

So, do you have any other advice? Maybe there is a way of checking (some sort of checklist?), if the shutdown is implemented correctly?
sikor
Techie
 
Posts: 12
Joined: Tue Sep 27, 2016 4:08 am

Re: Crash on closing the application

Postby magreenblatt » Thu Feb 21, 2019 4:27 pm

You only provided a partial call stack. What's the rest of it?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Crash on closing the application

Postby sikor » Tue Feb 26, 2019 3:15 am

Well, this is the full stack:

Code: Select all
libcef.dll!Profile::MaybeSendDestroyedNotification() Line 294   C++
libcef.dll!CefBrowserContext::Shutdown() Line 83   C++
libcef.dll!CefBrowserContextImpl::~CefBrowserContextImpl() Line 228   C++
libcef.dll!CefBrowserContextImpl::~CefBrowserContextImpl() Line 217   C++
libcef.dll!CefBrowserContextImpl::RemoveCefRequestContext(CefRequestContextImpl * context) Line 338   C++
libcef.dll!CefRequestContextImpl::~CefRequestContextImpl() Line 150   C++
[External Code]   
libcef.dll!content::BrowserThread::DeleteOnThread<content::BrowserThread::UI>::Destruct<CefImageImpl>(const CefImageImpl * x) Line 147   C++
[External Code]   
libcef.dll!CefBrowserHostImpl::~CefBrowserHostImpl() Line 598   C++
[External Code]   
libcef.dll!CefCppToCRefCounted<CefBrowserCppToC,CefBrowser,_cef_browser_t>::Release() Line 85   C++
libcef.dll!CefCppToCRefCounted<CefAuthCallbackCppToC,CefAuthCallback,_cef_auth_callback_t>::struct_release(_cef_base_ref_counted_t * base) Line 179   C++
Application.exe!CefCToCppRefCounted<CefContextMenuParamsCToCpp,CefContextMenuParams,_cef_context_menu_params_t>::Release() Line 169   C++
[External Code]   
sikor
Techie
 
Posts: 12
Joined: Tue Sep 27, 2016 4:08 am

Re: Crash on closing the application

Postby ndesktop » Tue Feb 26, 2019 5:26 am

I don't get why stack shows context menu prams > auth callback > browser release > shutdown.
Is this the normal flow?
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Crash on closing the application

Postby sikor » Tue Feb 26, 2019 6:33 am

In terms of ContextMenu, there is a class CefClientHelper, which overrides OnBeforeContextMenu just for:
Code: Select all
void CefClientHandler::OnBeforeContextMenu(
   CefRefPtr<CefBrowser>,
   CefRefPtr<CefFrame>,
   CefRefPtr<CefContextMenuParams>,
   CefRefPtr<CefMenuModel> model
)
{
   model->Clear();
}

The same class overrides CefRequestHandler methods (i.e OnBeforeBrowse, or OnResourceRedirect). In the CefRequestHandler base class I see
Code: Select all
  virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
                                  CefRefPtr<CefFrame> frame,
                                  bool isProxy,
                                  const CefString& host,
                                  int port,
                                  const CefString& realm,
                                  const CefString& scheme,
                                  CefRefPtr<CefAuthCallback> callback) {
    return false;
  }


But, the above method is not overridden in my code. I do not see any reference to CefAuthCallback neither. But, maybe in the base CefRequestHandler there is some reference kept to CefAuthCallback which causes that.
sikor
Techie
 
Posts: 12
Joined: Tue Sep 27, 2016 4:08 am

Re: Crash on closing the application

Postby magreenblatt » Tue Feb 26, 2019 10:17 am

I agree that call stack seems odd. You might want to check that you’re building against matching header/lib/binary/pdb files. It could also be some form of memory corruption in your app (use after free or unsafe cast to the wrong data type).
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Crash on closing the application

Postby sikor » Sun Mar 03, 2019 8:56 am

I cannot reproduce the problem and I have slightly modified the app.
SO, thanks for now. If it happens again, I will try to collect more data.
sikor
Techie
 
Posts: 12
Joined: Tue Sep 27, 2016 4:08 am

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 43 guests