简体   繁体   中英

How to destroy the Tchromium (Delphi) component dynamically created?

How to destroy the Tchromium component dynamically created ? I'm using in a DLL , the component necessary to create and destroy it several times without deallocate the DLL, the problem is that is not releasing memory and is unable to clear the cache folder. If I use CefShutDown problems occur in time to recreate the browser again. I'm using the latest version of DCEF3 . Create dynamically like this:

crm := TChromium.Create(Form1);
crm.SetParentComponent (Panel2);
crm.Align := alClient;

to destroy tried in several ways:

FreeAndNil(crm);
crm.free;
crm := nil;
CefShutDown;

The CefShutDown resolved in time to destroy , the problem is occurring by the time I try again recreate the component without deallocate my DLL.

Also solve another problem I'm having with the UserAgent can not change the recreation of the browser.

I appreciate any suggestions to solve my problem.

This behaviour is as designed. Issue 1237 on the Chromium issue tracker is identical to your issue. The relevant excerpt is:

CefInitialize/CefShutdown cannot be called multiple times in the same process. You can create/destroy multiple browser windows without re-initializing CEF.

You will have to refrain from calling CefShutDown .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM