salvadordf / CEF4Delphi

CEF4Delphi is an open source project to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows, Linux and MacOS.
https://www.briskbard.com/forum/
Other
1.21k stars 367 forks source link

Strange startup problem #37

Closed petko closed 6 years ago

petko commented 7 years ago

Under Delphi XE6 when I run the MiniBrowser demo (or any of my projects that use CEF4Delphi), in 1 out of 10 starts in average, the browser does not load properly. It will create the DOM (it will be available in ShowDebugTools), but will not display the web page. If you move the mouse around, it will change the cursor when it is over an edit control or a link, but the display will stay blank (mostly white, sometimes gray).

Does anybody else experience this and what could be causing it?

salvadordf commented 7 years ago

I've never seen that in Delphi 10.

It looks like a repaint issue. Have you tried to resize the component or to force a component refresh some other way?

petko commented 7 years ago

It turns out that in most cases the web page is finally drawn after a delay (which can be quite long for some pages). Something causes a big delay between loading the page and painting it.

Resize does not help. Also the mouse cursor constantly changes between a normal pointer and a waiting circle until the page is drawn.

petko commented 7 years ago

I am closing the issue, since it does not cause any harm to the code of my main project.

salvadordf commented 7 years ago

Allow me to reopen it... I remembered that someone also had a "slow startup" a few months. I thought it had something to do with firewalls but in the last couple of days I had to fix some variable declarations and I'm not sure if that could be causing this issue. I'll upload the changes as soon as I can.

salvadordf commented 7 years ago

Please, download the latest version of CEF4Delphi and check if you still have the "slow startup" problem.

petko commented 7 years ago

Unfortunately, it still occurs on my test machine.

P.S.: So you do not get this problem under Delphi 10?

mkormout commented 7 years ago

We have similar issue on some machines in DCEF3 Firemonkey Delphi 10.1. The browser window shows blank in 1 of 10 starts. After some mouse move and clicks fragments of the page are shown. When the browser is resized, everything turns right and the page looks correctly. Maybe the bug is inherited?

salvadordf commented 7 years ago

After many tests with the MiniBrowser and SimpleBrowser demos I finally saw one failed initialization in the SimpleBrowser.

My computer is very old and I had to do all the tests in a virtual machine with Delphi 10 and Windows 7 32 bit.

It's strange because BriskBard has both components (TChromium and TChromiumWindow) and I've never seen this problem. BriskBard creates almost everything at runtime so it might not be the best way to test this.

petko commented 7 years ago

Ok, I've run some tests:

MiniBrowser (both TCefWindowParent and TChromium created at designtime, Delphi XE7): With debugger: fails 7 out of 30 runs Without debugger: fails 9 out of 30 runs, 1 time loaded successfully, but the browser was not aligned properly (it is set to client, but was shown in a smaller rectangle)

My project (TChromiumWindow created at design time, TChromium created at runtime; C++Builder XE7): With debugger: fails 2 out of 30 runs Without debugger: does not fail in 30 runs

salvadordf commented 6 years ago

I uploaded a fix for this issue. The GlobalCEFApp initialization now uses a different approach and after many tests in all the demos I couldn't get the error anymore. If anyone is still having this problem please give me all the details you can : delphi version, custom cef directories or not, components used and if you create them at design time or run time.

petko commented 6 years ago

Just to confirm: I don't get any errors either..

krystian-broniszewski commented 3 years ago

i have only nlanc screen. why?

salvadordf commented 3 years ago

Check that the application calls TChromium.CreateBrowser when GlobalCEFApp.GlobalContextInitialized is true. Most demos have a timer to call TChromium.CreateBrowser again after a few milliseconds if it fails for that reason.

If you use a firewall in your network then you have to configure it in TChromium too.

Try the SimpleBrowser2 demo on your computer. If the demo works then compare the code to see if there's something missing in the application.

Please, use our forum for more questions : https://www.briskbard.com/forum/

krystian-broniszewski commented 3 years ago

SimpleBrowser2

thanx for reply, i try to your answer when i write you that is working

krystian-broniszewski commented 3 years ago

alvays problems. i don't know why. cef3 working wihtout problems, from2 years i try to use dcef 4 on delphi 7 and this is shit. i try to install delphi 10.4, then is component TEdgeBrowser - maybe this is solve my problem