Don't call createWindow before the app is ready for it (#1665)

This commit is contained in:
Scott Nonnenberg 2017-11-02 08:13:41 -07:00 committed by GitHub
parent d7ab2ec207
commit 30c5b62687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -269,8 +269,10 @@ function showAbout() {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
let ready = false;
app.on('ready', function() {
logger.info('app ready');
ready = true;
if (!locale) {
locale = loadLocale();
@ -310,6 +312,10 @@ app.on('window-all-closed', function () {
})
app.on('activate', function () {
if (!ready) {
return;
}
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow) {