From 30c5b626874da2850106e710ea43010ae35de46c Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 2 Nov 2017 08:13:41 -0700 Subject: [PATCH] Don't call createWindow before the app is ready for it (#1665) --- main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.js b/main.js index 130b0de3f..a71e7167b 100644 --- a/main.js +++ b/main.js @@ -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) {