Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash on startup in X11 #35092

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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