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

fix: dock.setIcon() crash before app ready
This commit is contained in:
Shelley Vohr 2022-11-09 17:13:24 +01:00 committed by GitHub
parent 5fc3ed936e
commit 1b1609aa0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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()];
}