From 1b1609aa0f7e282286ef2e842d5c895adcedfc86 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 9 Nov 2022 17:13:24 +0100 Subject: [PATCH] fix: `app.dock.setIcon()` crash before app ready (#36279) fix: dock.setIcon() crash before app ready --- shell/browser/browser_mac.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index e698e699e56..ab7942e369b 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -447,6 +447,13 @@ void Browser::DockSetIcon(v8::Isolate* isolate, v8::Local icon) { image = native_image->image(); } + // This is needed when this fn is called before the browser + // process is ready, since supported scales are normally set + // by ui::ResourceBundle::InitSharedInstance + // during browser process startup. + if (!is_ready()) + gfx::ImageSkia::SetSupportedScales({1.0f}); + [[AtomApplication sharedApplication] setApplicationIconImage:image.AsNSImage()]; }