Closing CEF while multi_threaded_message_loop = true

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Closing CEF while multi_threaded_message_loop = true

Postby akovar » Tue Jun 30, 2020 5:04 am


I am trying to properly close MFC app using CEF, but there are still some issues I do not understand. (We are using CEF with multi_threaded_message_loop = true)

- First when OnClose msg comes I try to close browser using host->CloseBrowser(false), this is OK and DoClose(...) callback is called and I return false and I prevent MFC CMainFrame to close
- Then CEF system sends a WM_CLOSE message to mainframe window, and then I, just to be sure, check if I really can close so I call host->TryCloseBrowser() but it always return false. When I tried to find out the reason, I ended up in CefBrowserHostImpl::TryCloseBrowser(). I am calling this from main thread so it does not really check if I can close and always returns false (because of CEF_CURRENTLY_ON_UIT )

Is there any other way how to check if I can close CEF?
cef.png (91.99 KiB) Viewed 106 times
Posts: 1
Joined: Tue Jun 30, 2020 4:25 am

Re: Closing CEF while multi_threaded_message_loop = true

Postby magreenblatt » Tue Jun 30, 2020 9:30 am

You will need to track the closing status yourself in the DoClose method instead of calling TryCloseBrowser. See the example implementation in cefclient (usage of the IsClosing method).
Site Admin
Posts: 10188
Joined: Fri May 29, 2009 6:57 pm

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 22 guests