Page 1 of 1

Closing CEF while multi_threaded_message_loop = true

PostPosted: Tue Jun 30, 2020 5:04 am
by akovar
Hello,

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?

Re: Closing CEF while multi_threaded_message_loop = true

PostPosted: Tue Jun 30, 2020 9:30 am
by magreenblatt
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).