Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Not closed Chrome_IOThread, CrBrowserMain, etc...

Post Reply
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Not closed Chrome_IOThread, CrBrowserMain, etc...

Post by salvadordf »

GlobalCEFApp needs to be initialized differently.

Most of the demos call GlobalCEFApp.StartMainProcess in the DPR file because they use the same EXE for all the subprocesses. In that case, GlobalCEFApp.StartMainProcess is the condition in a "if..then" clause because "Application.Run" should only be called once.

If your app can't modify the DPR file then you must configure GlobalCEFApp to use a different EXE for the subproceses.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Not closed Chrome_IOThread, CrBrowserMain, etc...

Post by salvadordf »

It doesn't matter if the app uses the browser a lot or infrequently. CEF3 needs to be initialized in a precise way or the app could have problems like this one.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Not closed Chrome_IOThread, CrBrowserMain, etc...

Post by salvadordf »

I would suggest to copy the initialization procedures from the "SubProcess" demo to your application.

That demo uses the uCEFLoader.pas unit to initialize and finalize CEF in the "initialization" and "finalization" sections.
It uses a different EXE for the subprocesses so it doesn't need to call GlobalCEFApp.StartMainProcess in the DPR file.

After that, open the ToolBoxBrowser demo and read the code comments about the browser destruction sequence in uMainForm.pas and uChildForm.pas. You need to follow those steps in order to close your app safely.
Post Reply