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.
This commit is contained in:
choigawoon committed 2023-11-08 16:32:00 +09:00
1 parent 94250ae2f5
commit 105077f068
1 file changed
+3 -3
+3 -3
View File
@@ -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)
}
})