CefFrame is NULL in OnContextCreated

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.

CefFrame is NULL in OnContextCreated

Postby Czarek » Wed May 23, 2018 1:56 pm

Is it something expected that CefFrame is NULL during execution of CefRenderProcessHandler.OnContextCreated? It's a reproducible issue with a particular website. Is it possible that frame is being destroyed during execution of OnContextCreated?

CEF branch 3359 on Linux.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CefFrame is NULL in OnContextCreated

Postby salvadordf » Wed May 23, 2018 2:23 pm

I just tested CefRenderProcessHandler.OnContextCreated and frame is not null if you load a local html file or visit google.com.

Tested with CEF 3.3359.1774.gd49d25f on Windows.
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects.
User avatar
salvadordf
Expert
 
Posts: 129
Joined: Sun Dec 18, 2016 8:39 am
Location: Spain

Re: CefFrame is NULL in OnContextCreated

Postby Czarek » Wed May 23, 2018 2:37 pm

I got more details from the user. It happens on some specific website, when creating browser for a short time only and destroying it thereafter. I guess the website does not complete to load and the browser is destroyed, thus frame is being destroyed during execution of OnContextCreated.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CefFrame is NULL in OnContextCreated

Postby magreenblatt » Wed May 23, 2018 3:29 pm

CefFrame is refcounted and there's only the single thread in the renderer process so it's unlikely that the pointer will become null while OnContextCreated is executing unless your code is setting it to null. A null CefFrame value passed into OnContextCreated is also unlikely due to checks in the translation layer.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CefFrame is NULL in OnContextCreated

Postby Czarek » Wed May 23, 2018 3:42 pm

That makes sense. I am sending frame ID to the browser process using IPC and then calling CefBrowser.GetFrame(ID) which returns NULL. Now it is clear and I know what to fix. Thanks!
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 30 guests