fix: app.dock.setIcon() crash before app ready (#36293)

fix: dock.setIcon() crash before app ready

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2022-11-09 15:00:20 -05:00
committed by GitHub
parent 04b3fb30ea
commit 548a91a24b

View File

@@ -447,6 +447,13 @@ void Browser::DockSetIcon(v8::Isolate* isolate, v8::Local<v8::Value> 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()];
}