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) { void AlloyBrowserHostImpl::SetFocus(bool focus) {
if (!CEF_CURRENTLY_ON_UIT()) { // Always execute asynchronously to work around issue #3040.
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetFocusInternal,
base::BindOnce(&AlloyBrowserHostImpl::SetFocus, this, focus)); this, focus));
return; }
}
void AlloyBrowserHostImpl::SetFocusInternal(bool focus) {
CEF_REQUIRE_UIT();
if (focus) if (focus)
OnSetFocus(FOCUS_SOURCE_SYSTEM); OnSetFocus(FOCUS_SOURCE_SYSTEM);
else if (platform_delegate_) else if (platform_delegate_)

View File

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