From 105077f0682e5b7faaf42028176c0818ef77637c Mon Sep 17 00:00:00 2001 From: choigawoon Date: Wed, 8 Nov 2023 16:32:00 +0900 Subject: [PATCH] Ensure asynchronous execution of window creation Add `await` keyword to `createMainWindow` calls within app's 'ready' and 'activate' events to ensure the mainWindow is fully initialized before proceeding. This fix addresses potential race conditions where mainWindow could be used before being properly set up. --- src/main/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index ae68f7e..1680859 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -12,12 +12,12 @@ app.on('ready', async () => { } macOSDisableDefaultMenuItem() - mainWindow = createMainWindow(mainWindow) + mainWindow = await createMainWindow(mainWindow) }) -app.on('activate', () => { +app.on('activate', async () => { if (!mainWindow) { - mainWindow = createMainWindow(mainWindow) + mainWindow = await createMainWindow(mainWindow) } })