Page 1 of 1

faulty CEF initialization

PostPosted: Thu Jul 29, 2021 2:24 am
by IvanPong1
Hi,

I have an issue where initializing CEF and creating a browser in OnContextInitialized leads to a browser that doesn't work. If I put a sleep statement in the before initializing the browser, the page usually loads. This is using the multi threaded message loop with an external exe taking care of CEF subprocesses. Since I'm integrating CEF with a pre-existing project, I cannot switch to either the single process, single threaded architectures or have CEF implement the message loop.

To show this problem, I've uploaded a minimal example here: https://github.com/IvanPong/CEFStartupExample
it requires Visual Studio on Windows 10. cefstuff has a built version of the libcef wrapper, but you can build it
yourself if you want to. There's a text file with instructions, but basically just dump all lib and dll files in cefstuff and it should work.
12/08/2020 - 87.1.12+g03f9336+chromium-87.0.4280.88 / Chromium 87.0.4280.88 from
https://cef-builds.spotifycdn.com/cef_b ... 64.tar.bz2

I've built CEF and verified that the spotify CDN matches what I built. Additionally, I have tested my project with a more recent version of CEF and verified that the issue still occurs.

The expected output is that the bitmap creation tool in OnPaint creates a bitmap in a created folder called 'ouptut' as bing.com is loaded (this can be changed, but bing is colorful) With the sleep set, this does happen. In the current configuration, the browser outputs a single black bitmap, then quits.

I have only included the essentials for initialization, so the project just crashes when you close it.


Thanks for any suggestions! Let me know if you have any questions about how to get the project going, if you need to run it to see what's wrong.

Re: faulty CEF initialization

PostPosted: Thu Jul 29, 2021 2:36 am
by amaitland
Is this the same as your previous thread?

viewtopic.php?f=6&t=18470&p=49334#p49334

Re: faulty CEF initialization

PostPosted: Thu Jul 29, 2021 9:02 am
by IvanPong1
Yes, it's the same problem. You can merge threads if you want. The code I'm posting is substantially different in a number of ways from the code I was having issues with there though.

Re: faulty CEF initialization

PostPosted: Thu Jul 29, 2021 3:19 pm
by amaitland
Better to keep discussion in one thread.

Re: faulty CEF initialization

PostPosted: Thu Jul 29, 2021 5:13 pm
by IvanPong1
ok, I'll keep that in mind in the future. Do you know what's going wrong in the initialization?

Re: faulty CEF initialization

PostPosted: Fri Jul 30, 2021 9:37 am
by IvanPong1
Should I register this as a bug?

As far as I can tell, none of the CEF example applications due this -they wait for window initialization instead of initializing the browser directly.

However, it seems like this is supposed to be supported. At the very least, when setting it as single threaded I can get everything to work.

Re: faulty CEF initialization

PostPosted: Fri Jul 30, 2021 1:31 pm
by magreenblatt
IvanPong1 wrote:Should I register this as a bug?

As far as I can tell, none of the CEF example applications due this -they wait for window initialization instead of initializing the browser directly.

However, it seems like this is supposed to be supported. At the very least, when setting it as single threaded I can get everything to work.

Single-threaded mode is not supported. Please don't file a bug unless the problem reproduces with the CEF sample applications.