Proper terminating procedure for CEF

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Proper terminating procedure for CEF

Postby videoaudio » Wed Feb 01, 2017 5:53 am


I am using CEF in single process mode and all of the process life cycle is working fine as documented.

I am terminating the process as per guidelines which is working fine as listed below.
Code: Select all
1. Initialise CEF in main thread: CefInitialize() and run Cef app.
2. wait on blocking call CefRunMessageLoop() in main thread after initialising CEF
3. as soon as close request arrives --> Issue CefBrowser->GetHost()->CloseBrowser(false/*Force_close*/); in CefApp
4. Handle CefLifeSpanHandler::OnBeforeClose in CefClient and call "CefQuitMessageLoop()"
5. This would lead to exit of CefRunMessageLoop() in main thread and CEF process will exit.

Where in I see some rare cases shutdown is not clean. i.e. user issues close request while CEF is being initialized.
1. Shutdown request issued when CEF was just started and JS initialisation is being done.
2. Even when CefRunMessageLoop exits, some JS to native callbacks (which were registered during CefAPP::OnContextCreated()) will try to get executed and eventually fail.
3. Isnt that we we call CefQuitMessageLoop() all the JS to native callbacks also get cleared?

Thanks in advance.
Posts: 36
Joined: Tue Feb 17, 2015 10:08 am

Re: Proper terminating procedure for CEF

Postby Czarek » Wed Feb 22, 2017 8:24 am

Single process mode is not for production.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. Connect with me on LinkedIn.
User avatar
Posts: 1905
Joined: Sun Nov 06, 2011 2:12 am

Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 3 guests