Version: CEF 73.1.11+ge6986dc+chromium-73.0.3683.75
OS: Windows 10 64bit
In my solution I have a CEF browser embedded in another Win32 application: so, multi_threaded_message_loop = true and window created like that
- Code: Select all
hWnd = CreateWindow(L"MyAppWindow", L"MyApp", WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, x, y, width, height, _hWndParent, NULL, _hInstance, NULL);
...
CefWindowInfo info;
info.SetAsChild(hWnd, rect);
...
CefBrowserHost::CreateBrowser(info, _cef_handler.get(), url, browser_settings, NULL);
The implementation is derived from cefsimple.
I give the possibility to close the embedded browser by calling window.close(); from javascript.
I think I managed well the closing routine (I use this solution in the last 3/4 years), but now I have a situation that cause a crash.
Running a webapp wich use more than one frame (maybe it is not the cause) and after working a little bit, when closing it occurs a crash in this function of window_tree_host.cc
- Code: Select all
ui::EventDispatchDetails WindowTreeHost::DispatchKeyEventPostIME(
ui::KeyEvent* event,
base::OnceCallback<void(bool)> ack_callback) {
// If dispatch to IME is already disabled we shouldn't reach here.
DCHECK(!dispatcher_->should_skip_ime());
dispatcher_->set_skip_ime(true);
// We should bypass event rewriters here as they've been tried before.
ui::EventDispatchDetails dispatch_details =
event_sink()->OnEventFromSource(event);
if (!dispatch_details.dispatcher_destroyed)
dispatcher_->set_skip_ime(false);
CallDispatchKeyEventPostIMEAck(event, std::move(ack_callback));
return dispatch_details;
}
in the specific DCHECK.
In the running javascript, the window.close is mapped on a particular keyevent.
I call CefBrowserHost::CloseBrowser(), I manage DoClose(), then I call CefShutdown and manage OnBeforeClose() where I free my reference on CefBrowser.
During OnBeforeClose() I can se 2 active frames for the browser: sometimes I can see 2 call of CefRenderProcessHandler::OnContextReleased() and someteimes I see only a single call.
Everytime two OnContextReleased() occurs, the crash happens.
Before crashing, it also appens that a GPU process starts and immediately ends.
I do not know if things are related, but it is the only evidences I've found between the two situations (the crash and the correct close).
I hope I've give all information needed.
Can anyone help me finding what I do wrong?