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.

Error on exit when MultiThreadedMessageLoop is disabled

User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Error on exit when MultiThreadedMessageLoop is disabled

Post by xpert13 »

Can you explain me why my app show me an error when I try to disable MultiThreadedMessageLoop?

Code: Select all

GlobalCEFApp.MultiThreadedMessageLoop := False;
Image
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by salvadordf »

I've added an issue to github about this problem :
https://github.com/salvadordf/CEF4Delphi/issues/71

For now, there's no fix for that crash.
User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by xpert13 »

Any ideas how to fix it?

I tried to find solution in Google but got no results :(
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by salvadordf »

Nothing yet... I'll keep looking.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by salvadordf »

The CEF3 code comments recommend to use GlobalCEFApp.MultiThreadedMessageLoop := False with GlobalCEFApp.ExternalMessagePump := True.
In that case we have to use the GlobalCEFApp.OnScheduleMessagePumpWork event to schedule the calls to CefDoMessageLoopWork.

The official CEF3 sample application use this event but the CEF4Delphi demos don't use it and it could be a clue of what's causing this problem.

I'll keep looking as soon as I can...
User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by xpert13 »

I don't think that it will fix this error.

I tried to use cef_run_message_loop instead calling cef_do_message_loop_work in timer and it's didn't help. Application crashed with the same error on exit;
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by salvadordf »

I fixed the issue but you'll have to set GlobalCEFApp.ExternalMessagePump to True too.

Please, download the latest CEF4Delphi version and read this :
https://www.briskbard.com/forum/viewtopic.php?f=8&t=222
User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by xpert13 »

Thank a lot for your help. But I can't understand how to destroy browser properly. I didn't use TCEFWindowParent. What I need to write in this function?

Code: Select all

procedure TExternalPumpBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage);
begin
  CEFWindowParent1.Free;
end;
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by salvadordf »

I'll add another demo for the TChromiumWindow tomorrow ;)

Edit : I think I answered too fast... I'll take a look tomorrow but it's possible you may have to use TChromium + TCEFWindowParent combination.
User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Re: Error on exit when MultiThreadedMessageLoop is disabled

Post by xpert13 »

Thank you. You are the best!!!
Post Reply