Skip to content

Commit

Permalink
fix: crash on startup in X11 (#35092)
Browse files Browse the repository at this point in the history
Fixes #34996.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
  • Loading branch information
trop[bot] and ckerr committed Jul 27, 2022
1 parent 09c4fdd commit 215ae2b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions shell/browser/electron_browser_main_parts.cc
Expand Up @@ -278,12 +278,6 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
}

int ElectronBrowserMainParts::PreCreateThreads() {
#if defined(USE_AURA)
if (!display::Screen::GetScreen()) {
screen_ = views::CreateDesktopScreen();
}
#endif

if (!views::LayoutProvider::Get())
layout_provider_ = std::make_unique<views::LayoutProvider>();

Expand Down Expand Up @@ -314,6 +308,14 @@ int ElectronBrowserMainParts::PreCreateThreads() {
// Load resources bundle according to locale.
std::string loaded_locale = LoadResourceBundle(locale);

#if defined(USE_AURA)
// NB: must be called _after_ locale resource bundle is loaded,
// because ui lib makes use of it in X11
if (!display::Screen::GetScreen()) {
screen_ = views::CreateDesktopScreen();
}
#endif

// Initialize the app locale.
std::string app_locale = l10n_util::GetApplicationLocale(loaded_locale);
ElectronBrowserClient::SetApplicationLocale(app_locale);
Expand Down

0 comments on commit 215ae2b

Please sign in to comment.