We are getting access violations in TCefUpdatePrefsTask.Execute() and in TCefCustomDeleteCookiesCallback.OnComplete()
Looks like events occurs after TChromium been closed and freed.
How to free TChromium correct and completely?
CEF version is 76.0.3809.132
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.
AV in TCefUpdatePrefsTask.Execute & TCefCustomDeleteCookiesCallback.OnComplete
- salvadordf
- Posts: 4571
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: AV in TCefUpdatePrefsTask.Execute & TCefCustomDeleteCookiesCallback.OnComplete
Hi,
Read the code comments in the demo you used as the template for your application.
There you'll find the "Destruction steps" that you must follow to destroy the browsers.
The CEF version 76.0.3809.132 needed to disable the "Network Service" before calling GlobalCEFApp.StartMainProcess in the DPR file.
The CEF4Delphi version uploaded today has fixed the shutdown issues we had recently. Read this for more information :
https://github.com/salvadordf/CEF4Delphi/issues/230
Read the code comments in the demo you used as the template for your application.
There you'll find the "Destruction steps" that you must follow to destroy the browsers.
The CEF version 76.0.3809.132 needed to disable the "Network Service" before calling GlobalCEFApp.StartMainProcess in the DPR file.
The CEF4Delphi version uploaded today has fixed the shutdown issues we had recently. Read this for more information :
https://github.com/salvadordf/CEF4Delphi/issues/230
Re: AV in TCefUpdatePrefsTask.Execute & TCefCustomDeleteCookiesCallback.OnComplete
Experimenting with disabling of NetworkService. Seems it didn't help.
Destruction steps are generally about freeing TCEFWindowParent while in my case I'd like to re-create browser with same TCEFWindowParent
Destruction steps are generally about freeing TCEFWindowParent while in my case I'd like to re-create browser with same TCEFWindowParent
- salvadordf
- Posts: 4571
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: AV in TCefUpdatePrefsTask.Execute & TCefCustomDeleteCookiesCallback.OnComplete
TCEFWindowParent is the father of some controls generated by CEF to draw the web contents.
Those controls need to be destroyed to trigger the TChromium.OnBeforeClose event. Without that event the browser is not destroyed properly and that's the cause of the access violations.
If you're planning on shutting down the browser wait until the cookies are deleted. Wait until the TChromium.OnCookiesDeleted event is triggered.
It's not necessary to call TChromium.UpdatePreferences each time you need to set new preferences if you plan to navigate to a new URL because they are updated automatically in TChromiumCore.doOnBeforeBrowse.
Those controls need to be destroyed to trigger the TChromium.OnBeforeClose event. Without that event the browser is not destroyed properly and that's the cause of the access violations.
If you're planning on shutting down the browser wait until the cookies are deleted. Wait until the TChromium.OnCookiesDeleted event is triggered.
It's not necessary to call TChromium.UpdatePreferences each time you need to set new preferences if you plan to navigate to a new URL because they are updated automatically in TChromiumCore.doOnBeforeBrowse.