OnPaint sometimes not called.

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.

OnPaint sometimes not called.

Postby akaltar » Tue Nov 22, 2016 5:07 pm

I cannot reproduce this using the CefClient, because it requires recreating the browser window.

This didn't happen in 3.2785.1485.g2b5c3a7 and does in 3.2840.1518.gffd843c OS: Both Windows 7 and Ubuntu 16.04 LTS.
flags: enable-offscreen-rendering disable-gpu disable-gpu-compositing enable-begin-frame-scheduling


When I set a page on auto-refresh(re-creating the browser on each "refresh"), sometimes(About 20%) the page is not getting rendered. ie: OnPaint is never called.

I tried adding and Invalidate call to onLoadStateChanged, when isLoading is false. In this case OnPaint gets called, but with a black image.

If there are some inputs on the page, hovering over them(thus changing the image) gets OnPaint called with the correct image.

Expected behaviour: After the page loads OnPaint gets called with the finished image.

What could be causing this?
Last edited by akaltar on Tue Nov 22, 2016 6:14 pm, edited 1 time in total.
akaltar
Techie
 
Posts: 11
Joined: Wed Jun 22, 2016 7:48 am

Re: OnPaint sometimes not called.

Postby magreenblatt » Tue Nov 22, 2016 5:19 pm

What do you mean by "recreating the browser window"?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: OnPaint sometimes not called.

Postby akaltar » Tue Nov 22, 2016 5:43 pm

Destroying the CefClient, CefBrowser and creating a new one using CreateBrowserSync.
akaltar
Techie
 
Posts: 11
Joined: Wed Jun 22, 2016 7:48 am

Re: OnPaint sometimes not called.

Postby magreenblatt » Tue Nov 22, 2016 5:52 pm

Do you see similar problems with cefclient if you create multiple browsers using Tests > New Window?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: OnPaint sometimes not called.

Postby akaltar » Tue Nov 22, 2016 6:11 pm

No, I can't reproduce it.

I think the error might be some race condition, because I am not checking any threading anywhere(Like REQUIRE_UI_THREAD()), I am just not sure where or what is necessary, because the documentation is vague or outdated very often.

Also it seems to happen only with local files. Perhaps loading speed is a factor.
akaltar
Techie
 
Posts: 11
Joined: Wed Jun 22, 2016 7:48 am

Re: OnPaint sometimes not called.

Postby digory » Mon Nov 28, 2016 11:37 am

I'm not sure I fully understand your situation. However, I also had an issue that some WM_PAINT seemed to be dropped. In my case, the problem was that my parent window did not set the style WS_CLIPCHILDREN. Hence, when the parent window received a WM_PAINT, it painted its background color all over the CEF window (which is a child window in my case), which looked as if the child never received the WM_PAINT. (It did though.) The solution was simply to set WS_CLIPCHILDREN in the parent window. This will ensure the parent cannot paint over any child window. Maybe something similar happens in your case?
digory
Expert
 
Posts: 118
Joined: Wed Oct 26, 2016 3:13 am

Re: OnPaint sometimes not called.

Postby akaltar » Mon Nov 28, 2016 11:59 am

When you are using CEF in Off-screen rendering mode(for example when using OpenGL to do the actual rendering, or generally you need compositing after render, etc.) CEF calls CefRenderHandler::OnPaint with the changed view.

In my case I put a debug print in the OnPaint function, which doesn't get called. I don't know if I am doing something wrong or not, but this worked perfectly in one version, and now doesn't. Also it doesn't work only sometimes(about 20%), which makes it even harder to track down.

There might be an error in how I am calling CEF functions, though for such a simple use-case I doubt that should be the problem.

Still I have literally no idea how can this happen, while everything works perfectly in a not so much older version.
I am also doing other weird things. Like in this case I have multiple CefClients and CefBrowsers(One to one mapping) and I am loading this as a plugin at runtime. It also only has a single window. So I don't think that being unable to reproduce this in the fundamentally different sample application would make sure it isn't a bug in CEF itself.

For now I am using the older version because it just works, though this is pretty bad, as the older version has a problem with 64bit...
akaltar
Techie
 
Posts: 11
Joined: Wed Jun 22, 2016 7:48 am

Re: OnPaint sometimes not called.

Postby magreenblatt » Mon Nov 28, 2016 12:25 pm

Without being able to reproduce the problem in cefclient there's not much that we can do to debug it for you. I would suggest that you build CEF/Chromium from source code and debug the libcef/browser/osr/render_widget_host_view_osr* code to see if you can identify the problem when running with your application.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: OnPaint sometimes not called.

Postby akaltar » Mon Nov 28, 2016 12:45 pm

Thank you! That small thing of where to look is possibly all the help I need / All that I was looking for. I'll try that.
akaltar
Techie
 
Posts: 11
Joined: Wed Jun 22, 2016 7:48 am


Return to Support Forum

Who is online

Users browsing this forum: ElAndLivia, Google [Bot] and 82 guests