Add workaround for crash on popup window creation (see issue #3040)

This commit is contained in:
Marshall Greenblatt 2020-11-25 12:57:53 -05:00
parent 71179da2f6
commit 2a64387259
2 changed files with 8 additions and 5 deletions

View File

@ -364,12 +364,13 @@ bool AlloyBrowserHostImpl::TryCloseBrowser() {
}
void AlloyBrowserHostImpl::SetFocus(bool focus) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&AlloyBrowserHostImpl::SetFocus, this, focus));
return;
}
// Always execute asynchronously to work around issue #3040.
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetFocusInternal,
this, focus));
}
void AlloyBrowserHostImpl::SetFocusInternal(bool focus) {
CEF_REQUIRE_UIT();
if (focus)
OnSetFocus(FOCUS_SOURCE_SYSTEM);
else if (platform_delegate_)

View File

@ -370,6 +370,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void InitializeDevToolsRegistrationOnUIThread(
CefRefPtr<CefRegistration> registration);
void SetFocusInternal(bool focus);
CefWindowHandle opener_;
const bool is_windowless_;
const bool is_views_hosted_;