Browser doesn't paint after reparenting

Having problems with building or using the JCEF Java binding? Ask your questions here.

Browser doesn't paint after reparenting

Postby Phylanx » Tue Oct 22, 2024 1:20 am

Hi!

We got a bug reported by one of our customers and I remember we had a similar topic ages ago (versions 2704 and 3325 I guess).
Sometimes after reparenting the browser ui doesn't refresh anymore and paints the java controls over it for a rectangle and the rest of the browser is simply black.
I could reproduce it in the detailed MainFrame, see:
BugReproducedDetailedMainFrame.png
BugReproducedDetailedMainFrame.png (80.72 KiB) Viewed 1783 times


How to reproduce:
[*]Start detailed MainFrame
[*]Test reparenting (Menu -> Tests -> Reparent)
[*]In newly opened window press Reparent button as fast as you can (or after first click use space bar, that's even faster)
After some time the problem can be reproduced.

When the problem occured the browser can't be fixed, it never paints the actual HTML that it should.
But in the background everything works fine. For example if you enter a URL and load it, you see in the logging that the actual page should be loaded correctly.
So I guess that only a window handle or something like that is wrong.

Environment:
JCEF versions 4147 (currently productive on customer site) and 6261 (currently upgraded internally).
Windows 10/11 with 32 bit jcef binaries, windowed rendering

I already checked the java code, everything should be fine (panel and canvas are correctly added to the frame, the content_rect is the correct size).
I fear that the problem lies in the native part of jcef.
If you take a closer look on the image, you see that the size the part that paints the java window is exactly the same size as the reparent window, everything else is black and not painted.
If you change the size of the reparent window and reparent again, the black region changes and adapts to the new size of the reparent window.

Does somebody know where to start?
I'll investigate more in the native part of jcef, but I'm far more better on java side, so some direction to start with would be great!
Phylanx
Expert
 
Posts: 226
Joined: Thu Aug 11, 2016 8:17 am

Re: Browser doesn't paint after reparenting

Postby Phylanx » Tue Oct 22, 2024 4:32 am

Further analysis show that it might depend on something with virtual machines.

I cannot reproduce the problem locally on my physical machine, but it happens on my virtual development environment.
Also the customer reported the behavior on a remote desktop machine.
Phylanx
Expert
 
Posts: 226
Joined: Thu Aug 11, 2016 8:17 am

Re: Browser doesn't paint after reparenting

Postby Phylanx » Fri Oct 25, 2024 6:55 am

After some analysis we found out that this was no problem of virtual machines.
JCEF has still this problem that we fix with every upgrade (which I forgot this time, as my last upgrade was years ago): https://github.com/chromiumembedded/java-cef/issues/321

The hotfix in there still works and fixes our problems.
We'll stick with that.
Phylanx
Expert
 
Posts: 226
Joined: Thu Aug 11, 2016 8:17 am

Re: Browser doesn't paint after reparenting

Postby magreenblatt » Fri Oct 25, 2024 8:27 am

If you submit the fix as a PR we can probably merge it.
magreenblatt
Site Admin
 
Posts: 12810
Joined: Fri May 29, 2009 6:57 pm

Re: Browser doesn't paint after reparenting

Postby Phylanx » Wed Oct 30, 2024 1:48 am

OK, I'll try to build a fix, but I can just test the result for windows, I don't have a chance for Linux (Mac shoudln't be touched).

I'm rather new to the whole pull request thing, but I'll try! :)

// EDIT:
Ok, done, I think:
https://github.com/chromiumembedded/java-cef/pull/486
Phylanx
Expert
 
Posts: 226
Joined: Thu Aug 11, 2016 8:17 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 24 guests